Minh Nguyen / ArduinoJson
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers is_integral.hpp Source File

is_integral.hpp

00001 // ArduinoJson - arduinojson.org
00002 // Copyright Benoit Blanchon 2014-2021
00003 // MIT License
00004 
00005 #pragma once
00006 
00007 #include <ArduinoJson/Configuration.hpp>
00008 #include "is_same.hpp"
00009 
00010 namespace ARDUINOJSON_NAMESPACE {
00011 
00012 // A meta-function that returns true if T is an integral type.
00013 template <typename T>
00014 struct is_integral {
00015   static const bool value =
00016       is_same<T, signed char>::value || is_same<T, unsigned char>::value ||
00017       is_same<T, signed short>::value || is_same<T, unsigned short>::value ||
00018       is_same<T, signed int>::value || is_same<T, unsigned int>::value ||
00019       is_same<T, signed long>::value || is_same<T, unsigned long>::value ||
00020 #if ARDUINOJSON_HAS_LONG_LONG
00021       is_same<T, signed long long>::value ||
00022       is_same<T, unsigned long long>::value ||
00023 #endif
00024 #if ARDUINOJSON_HAS_INT64
00025       is_same<T, signed __int64>::value ||
00026       is_same<T, unsigned __int64>::value ||
00027 #endif
00028       is_same<T, char>::value || is_same<T, bool>::value;
00029 };
00030 
00031 template <typename T>
00032 struct is_integral<const T> : is_integral<T> {};
00033 }  // namespace ARDUINOJSON_NAMESPACE