[meta] Add is_floating_point

This commit is contained in:
Behdad Esfahbod 2019-05-10 19:56:36 -07:00
parent 25bb7e005d
commit 3919ca41b5
1 changed files with 19 additions and 14 deletions

View File

@ -228,6 +228,25 @@ struct hb_reference_wrapper<T&>
};
template <typename T> struct hb_is_integral { static constexpr bool value = false;};
template <> struct hb_is_integral<char> { static constexpr bool value = true; };
template <> struct hb_is_integral<signed char> { static constexpr bool value = true; };
template <> struct hb_is_integral<unsigned char> { static constexpr bool value = true; };
template <> struct hb_is_integral<signed short> { static constexpr bool value = true; };
template <> struct hb_is_integral<unsigned short> { static constexpr bool value = true; };
template <> struct hb_is_integral<signed int> { static constexpr bool value = true; };
template <> struct hb_is_integral<unsigned int> { static constexpr bool value = true; };
template <> struct hb_is_integral<signed long> { static constexpr bool value = true; };
template <> struct hb_is_integral<unsigned long> { static constexpr bool value = true; };
template <> struct hb_is_integral<signed long long> { static constexpr bool value = true; };
template <> struct hb_is_integral<unsigned long long> { static constexpr bool value = true; };
template <typename T> struct hb_is_floating_point { static constexpr bool value = false;};
template <> struct hb_is_floating_point<float> { static constexpr bool value = true; };
template <> struct hb_is_floating_point<double> { static constexpr bool value = true; };
template <> struct hb_is_floating_point<long double> { static constexpr bool value = true; };
#define hb_is_integral(T) hb_is_integral<T>::value
template <typename T> struct hb_is_signed;
template <> struct hb_is_signed<char> { static constexpr bool value = CHAR_MIN < 0; };
template <> struct hb_is_signed<signed char> { static constexpr bool value = true; };
@ -277,19 +296,5 @@ template <> struct hb_signedness_int<false> { typedef unsigned int value; };
template <> struct hb_signedness_int<true> { typedef signed int value; };
#define hb_signedness_int(T) hb_signedness_int<T>::value
template <typename T> struct hb_is_integral { static constexpr bool value = false;};
template <> struct hb_is_integral<char> { static constexpr bool value = true; };
template <> struct hb_is_integral<signed char> { static constexpr bool value = true; };
template <> struct hb_is_integral<unsigned char> { static constexpr bool value = true; };
template <> struct hb_is_integral<signed short> { static constexpr bool value = true; };
template <> struct hb_is_integral<unsigned short> { static constexpr bool value = true; };
template <> struct hb_is_integral<signed int> { static constexpr bool value = true; };
template <> struct hb_is_integral<unsigned int> { static constexpr bool value = true; };
template <> struct hb_is_integral<signed long> { static constexpr bool value = true; };
template <> struct hb_is_integral<unsigned long> { static constexpr bool value = true; };
template <> struct hb_is_integral<signed long long> { static constexpr bool value = true; };
template <> struct hb_is_integral<unsigned long long> { static constexpr bool value = true; };
#define hb_is_integral(T) hb_is_integral<T>::value
#endif /* HB_META_HH */