|
24 | 24 |
|
25 | 25 | namespace daw {
|
26 | 26 | template<typename T>
|
27 |
| - using is_integral = std::bool_constant<daw::numeric_limits<T>::is_integer>; |
| 27 | + inline constexpr bool is_integral_v = daw::numeric_limits<T>::is_integer; |
28 | 28 |
|
29 | 29 | template<typename T>
|
30 |
| - inline constexpr bool is_integral_v = is_integral<T>::value; |
| 30 | + using is_integral = std::bool_constant<is_integral_v<T>>; |
31 | 31 |
|
32 | 32 | static_assert( is_integral_v<int> );
|
33 | 33 | static_assert( not is_integral_v<float> );
|
34 | 34 |
|
35 |
| - namespace arith_traits_details { |
36 |
| - template<typename T> |
37 |
| - using limits_is_signed = |
38 |
| - std::bool_constant<daw::numeric_limits<T>::is_signed>; |
39 |
| - |
40 |
| - template<typename T> |
41 |
| - using limits_is_exact = |
42 |
| - std::bool_constant<daw::numeric_limits<T>::is_exact>; |
43 |
| - |
44 |
| - } // namespace arith_traits_details |
45 |
| - |
46 | 35 | template<typename T>
|
47 |
| - using is_floating_point = |
48 |
| - std::conjunction<std::negation<is_integral<T>>, |
49 |
| - arith_traits_details::limits_is_signed<T>, |
50 |
| - std::negation<arith_traits_details::limits_is_exact<T>>>; |
| 36 | + inline constexpr bool is_floating_point_v = |
| 37 | + not is_integral_v<T> and daw::numeric_limits<T>::is_signed and |
| 38 | + not daw::numeric_limits<T>::is_exact; |
51 | 39 |
|
52 | 40 | template<typename T>
|
53 |
| - inline constexpr bool is_floating_point_v = is_floating_point<T>::value; |
| 41 | + using is_floating_point = std::bool_constant<is_floating_point_v<T>>; |
54 | 42 |
|
55 | 43 | static_assert( is_floating_point_v<float> );
|
56 | 44 | static_assert( not is_floating_point_v<int> );
|
57 | 45 |
|
58 | 46 | template<typename T>
|
59 |
| - using is_number = std::disjunction<is_integral<T>, is_floating_point<T>>; |
| 47 | + inline constexpr bool is_number_v = |
| 48 | + is_integral_v<T> or is_floating_point_v<T>; |
60 | 49 |
|
61 | 50 | template<typename T>
|
62 |
| - inline constexpr bool is_number_v = is_number<T>::value; |
| 51 | + using is_number = std::bool_constant<is_number_v<T>>; |
63 | 52 |
|
64 | 53 | static_assert( is_number_v<float> );
|
65 | 54 | static_assert( is_number_v<int> );
|
66 | 55 | static_assert( not is_number_v<is_integral<int>> );
|
67 | 56 |
|
68 | 57 | template<typename T>
|
69 |
| - using is_signed = |
70 |
| - std::conjunction<is_number<T>, arith_traits_details::limits_is_signed<T>>; |
| 58 | + inline constexpr bool is_signed_v = |
| 59 | + is_number_v<T> and daw::numeric_limits<T>::is_signed; |
71 | 60 |
|
72 | 61 | template<typename T>
|
73 |
| - inline constexpr bool is_signed_v = is_signed<T>::value; |
| 62 | + using is_signed = std::bool_constant<is_signed_v<T>>; |
74 | 63 |
|
75 | 64 | static_assert( is_signed_v<int> );
|
76 | 65 | static_assert( is_signed_v<float> );
|
77 | 66 | static_assert( not is_signed_v<unsigned> );
|
78 | 67 |
|
79 | 68 | template<typename T>
|
80 |
| - using is_unsigned = |
81 |
| - std::conjunction<is_integral<T>, |
82 |
| - std::negation<arith_traits_details::limits_is_signed<T>>>; |
| 69 | + inline constexpr bool is_unsigned_v = |
| 70 | + is_integral_v<T> and not daw::numeric_limits<T>::is_signed; |
83 | 71 |
|
84 | 72 | template<typename T>
|
85 |
| - inline constexpr bool is_unsigned_v = is_unsigned<T>::value; |
| 73 | + using is_unsigned = std::bool_constant<is_unsigned_v<T>>; |
86 | 74 |
|
87 | 75 | static_assert( not is_unsigned_v<int> );
|
88 | 76 | static_assert( not is_unsigned_v<float> );
|
89 | 77 | static_assert( is_unsigned_v<unsigned> );
|
90 | 78 |
|
91 | 79 | template<typename T>
|
92 |
| - using is_arithmetic = |
93 |
| - std::disjunction<is_number<T>, std::is_enum<T>, |
94 |
| - conditional_t<daw::numeric_limits<T>::is_specialized, |
95 |
| - std::true_type, std::false_type>>; |
| 80 | + inline constexpr bool is_arithmetic_v = |
| 81 | + is_number_v<T> or std::is_enum_v<T> or |
| 82 | + daw::numeric_limits<T>::is_specialized; |
96 | 83 |
|
97 | 84 | template<typename T>
|
98 |
| - inline constexpr bool is_arithmetic_v = is_arithmetic<T>::value; |
| 85 | + using is_arithmetic = std::bool_constant<is_arithmetic_v<T>>; |
99 | 86 |
|
100 | 87 | template<typename T>
|
101 | 88 | struct make_unsigned : std::make_unsigned<T> {};
|
|
0 commit comments