diff --git a/include/EASTL/internal/type_fundamental.h b/include/EASTL/internal/type_fundamental.h index 14780db..7ba3235 100644 --- a/include/EASTL/internal/type_fundamental.h +++ b/include/EASTL/internal/type_fundamental.h @@ -79,38 +79,34 @@ namespace eastl // /////////////////////////////////////////////////////////////////////// template struct is_integral : public false_type{}; - - // To do: Need to define volatile and const volatile versions of these. - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; + + #define EASTL_TMP_DECLARE_INTEGRAL_WITH_CV(T)\ + template <> struct is_integral : public true_type{};\ + template <> struct is_integral : public true_type{};\ + template <> struct is_integral : public true_type{};\ + template <> struct is_integral : public true_type{}; + + EASTL_TMP_DECLARE_INTEGRAL_WITH_CV(unsigned char) + EASTL_TMP_DECLARE_INTEGRAL_WITH_CV(unsigned short) + EASTL_TMP_DECLARE_INTEGRAL_WITH_CV(unsigned int) + EASTL_TMP_DECLARE_INTEGRAL_WITH_CV(unsigned long) + EASTL_TMP_DECLARE_INTEGRAL_WITH_CV(unsigned long long) + + EASTL_TMP_DECLARE_INTEGRAL_WITH_CV(signed char) + EASTL_TMP_DECLARE_INTEGRAL_WITH_CV(signed short) + EASTL_TMP_DECLARE_INTEGRAL_WITH_CV(signed int) + EASTL_TMP_DECLARE_INTEGRAL_WITH_CV(signed long) + EASTL_TMP_DECLARE_INTEGRAL_WITH_CV(signed long long) + + EASTL_TMP_DECLARE_INTEGRAL_WITH_CV(bool) + EASTL_TMP_DECLARE_INTEGRAL_WITH_CV(char) + #ifndef EA_WCHAR_T_NON_NATIVE // If wchar_t is a native type instead of simply a define to an existing type... - template <> struct is_integral : public true_type{}; - template <> struct is_integral : public true_type{}; + EASTL_TMP_DECLARE_INTEGRAL_WITH_CV(wchar_t) #endif + + #undef EASTL_TMP_DECLARE_INTEGRAL_WITH_CV + /////////////////////////////////////////////////////////////////////// // is_floating_point @@ -122,15 +118,18 @@ namespace eastl // /////////////////////////////////////////////////////////////////////// template struct is_floating_point : public false_type{}; - - // To do: Need to define volatile and const volatile versions of these. - template <> struct is_floating_point : public true_type{}; - template <> struct is_floating_point : public true_type{}; - template <> struct is_floating_point : public true_type{}; - template <> struct is_floating_point : public true_type{}; - template <> struct is_floating_point : public true_type{}; - template <> struct is_floating_point : public true_type{}; - + + #define EASTL_TMP_DECLARE_FLOATING_POINT_WITH_CV(T)\ + template <> struct is_floating_point : public true_type{};\ + template <> struct is_floating_point : public true_type{};\ + template <> struct is_floating_point : public true_type{};\ + template <> struct is_floating_point : public true_type{}; + + EASTL_TMP_DECLARE_FLOATING_POINT_WITH_CV(float) + EASTL_TMP_DECLARE_FLOATING_POINT_WITH_CV(double) + EASTL_TMP_DECLARE_FLOATING_POINT_WITH_CV(long double) + + #undef EASTL_TMP_DECLARE_FLOATING_POINT_WITH_CV /////////////////////////////////////////////////////////////////////// diff --git a/include/EASTL/internal/type_properties.h b/include/EASTL/internal/type_properties.h index a4ef897..8fb7f67 100644 --- a/include/EASTL/internal/type_properties.h +++ b/include/EASTL/internal/type_properties.h @@ -106,29 +106,30 @@ namespace eastl // set a given class to be identified as a signed type. /////////////////////////////////////////////////////////////////////// template struct is_signed : public false_type{}; - - template <> struct is_signed : public true_type{}; - template <> struct is_signed : public true_type{}; - template <> struct is_signed : public true_type{}; - template <> struct is_signed : public true_type{}; - template <> struct is_signed : public true_type{}; - template <> struct is_signed : public true_type{}; - template <> struct is_signed : public true_type{}; - template <> struct is_signed : public true_type{}; - template <> struct is_signed : public true_type{}; - template <> struct is_signed : public true_type{}; - + + #define EASTL_TMP_DECLARE_SIGNED_WITH_CV(T)\ + template <> struct is_signed : public true_type{};\ + template <> struct is_signed : public true_type{};\ + template <> struct is_signed : public true_type{};\ + template <> struct is_signed : public true_type{}; + + EASTL_TMP_DECLARE_SIGNED_WITH_CV(signed char) + EASTL_TMP_DECLARE_SIGNED_WITH_CV(signed short) + EASTL_TMP_DECLARE_SIGNED_WITH_CV(signed int) + EASTL_TMP_DECLARE_SIGNED_WITH_CV(signed long) + EASTL_TMP_DECLARE_SIGNED_WITH_CV(signed long long) + #if (CHAR_MAX == SCHAR_MAX) - template <> struct is_signed : public true_type{}; - template <> struct is_signed : public true_type{}; + EASTL_TMP_DECLARE_SIGNED_WITH_CV(char) #endif #ifndef EA_WCHAR_T_NON_NATIVE // If wchar_t is a native type instead of simply a define to an existing type... #if defined(__WCHAR_MAX__) && ((__WCHAR_MAX__ == 2147483647) || (__WCHAR_MAX__ == 32767)) // GCC defines __WCHAR_MAX__ for most platforms. - template <> struct is_signed : public true_type{}; - template <> struct is_signed : public true_type{}; + EASTL_TMP_DECLARE_SIGNED_WITH_CV(wchar_t) #endif #endif - + + #undef EASTL_TMP_DECLARE_SIGNED_WITH_CV + #define EASTL_DECLARE_SIGNED(T) namespace eastl{ template <> struct is_signed : public true_type{}; template <> struct is_signed : public true_type{}; } @@ -150,29 +151,30 @@ namespace eastl // set a given class to be identified as an unsigned type. /////////////////////////////////////////////////////////////////////// template struct is_unsigned : public false_type{}; - - template <> struct is_unsigned : public true_type{}; - template <> struct is_unsigned : public true_type{}; - template <> struct is_unsigned : public true_type{}; - template <> struct is_unsigned : public true_type{}; - template <> struct is_unsigned : public true_type{}; - template <> struct is_unsigned : public true_type{}; - template <> struct is_unsigned : public true_type{}; - template <> struct is_unsigned : public true_type{}; - template <> struct is_unsigned : public true_type{}; - template <> struct is_unsigned : public true_type{}; - + + #define EASTL_TMP_DECLARE_UNSIGNED_WITH_CV(T)\ + template <> struct is_unsigned : public true_type{};\ + template <> struct is_unsigned : public true_type{};\ + template <> struct is_unsigned : public true_type{};\ + template <> struct is_unsigned : public true_type{}; + + EASTL_TMP_DECLARE_UNSIGNED_WITH_CV(unsigned char) + EASTL_TMP_DECLARE_UNSIGNED_WITH_CV(unsigned short) + EASTL_TMP_DECLARE_UNSIGNED_WITH_CV(unsigned int) + EASTL_TMP_DECLARE_UNSIGNED_WITH_CV(unsigned long) + EASTL_TMP_DECLARE_UNSIGNED_WITH_CV(unsigned long long) + #if (CHAR_MAX == UCHAR_MAX) - template <> struct is_unsigned : public true_type{}; - template <> struct is_unsigned : public true_type{}; + EASTL_TMP_DECLARE_UNSIGNED_WITH_CV(char) #endif #ifndef EA_WCHAR_T_NON_NATIVE // If wchar_t is a native type instead of simply a define to an existing type... #if defined(_MSC_VER) || (defined(__WCHAR_MAX__) && ((__WCHAR_MAX__ == 4294967295U) || (__WCHAR_MAX__ == 65535))) // GCC defines __WCHAR_MAX__ for most platforms. - template <> struct is_unsigned : public true_type{}; - template <> struct is_unsigned : public true_type{}; + EASTL_TMP_DECLARE_UNSIGNED_WITH_CV(wchar_t) #endif #endif - + + #undef EASTL_TMP_DECLARE_UNSIGNED_WITH_CV + #define EASTL_DECLARE_UNSIGNED(T) namespace eastl{ template <> struct is_unsigned : public true_type{}; template <> struct is_unsigned : public true_type{}; }