提交 e939d88b 编写于 作者: B Behdad Esfahbod

[meta] Rewrite is_integral / is_floating_point, add is_arithmetic

上级 c3a456a2
...@@ -221,25 +221,38 @@ struct hb_reference_wrapper<T&> ...@@ -221,25 +221,38 @@ struct hb_reference_wrapper<T&>
}; };
template <typename T> struct hb_is_integral { static constexpr bool value = false;}; template <typename T>
template <> struct hb_is_integral<char> { static constexpr bool value = true; }; using hb_is_integral = hb_bool_constant<
template <> struct hb_is_integral<signed char> { static constexpr bool value = true; }; hb_is_same (hb_decay<T>, char) ||
template <> struct hb_is_integral<unsigned char> { static constexpr bool value = true; }; hb_is_same (hb_decay<T>, signed char) ||
template <> struct hb_is_integral<signed short> { static constexpr bool value = true; }; hb_is_same (hb_decay<T>, unsigned char) ||
template <> struct hb_is_integral<unsigned short> { static constexpr bool value = true; }; hb_is_same (hb_decay<T>, signed int) ||
template <> struct hb_is_integral<signed int> { static constexpr bool value = true; }; hb_is_same (hb_decay<T>, unsigned int) ||
template <> struct hb_is_integral<unsigned int> { static constexpr bool value = true; }; hb_is_same (hb_decay<T>, signed short) ||
template <> struct hb_is_integral<signed long> { static constexpr bool value = true; }; hb_is_same (hb_decay<T>, unsigned short) ||
template <> struct hb_is_integral<unsigned long> { static constexpr bool value = true; }; hb_is_same (hb_decay<T>, signed long) ||
template <> struct hb_is_integral<signed long long> { static constexpr bool value = true; }; hb_is_same (hb_decay<T>, unsigned long) ||
template <> struct hb_is_integral<unsigned long long> { static constexpr bool value = true; }; hb_is_same (hb_decay<T>, signed long long) ||
hb_is_same (hb_decay<T>, unsigned long long) ||
template <typename T> struct hb_is_floating_point { static constexpr bool value = false;}; 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 #define hb_is_integral(T) hb_is_integral<T>::value
template <typename T>
using hb_is_floating_point = hb_bool_constant<
hb_is_same (hb_decay<T>, float) ||
hb_is_same (hb_decay<T>, double) ||
hb_is_same (hb_decay<T>, long double) ||
false
>;
#define hb_is_floating_point(T) hb_is_floating_point<T>::value
template <typename T>
using hb_is_arithmetic = hb_bool_constant<
hb_is_integral (T) ||
hb_is_floating_point (T) ||
false
>;
#define hb_is_arighmetic(T) hb_is_arighmetic<T>::value
template <typename T> struct hb_is_signed; 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<char> { static constexpr bool value = CHAR_MIN < 0; };
template <> struct hb_is_signed<signed char> { static constexpr bool value = true; }; template <> struct hb_is_signed<signed char> { static constexpr bool value = true; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册