|
1 | | -#include "lax_v1/comparison.hpp" |
2 | | -#include "lax_v1/logical.hpp" |
3 | | -#include "lax_v1/type.hpp" |
4 | | -#include "lax_v1/type_traits.hpp" |
5 | | -#include "lax_v1/value.hpp" |
6 | | - |
7 | | -#include <type_traits> |
8 | | - |
9 | | -namespace lax = lax_v1; |
10 | | - |
11 | | -static_assert(std::is_same_v<lax::value_t<bool, true>::value_type, bool>); |
12 | | - |
13 | | -static_assert(std::is_same_v<lax::value_t<char, 'x'>::value_type, char>); |
14 | | -static_assert(std::is_same_v<lax::value_t<short, 101>::value_type, short>); |
15 | | -static_assert(std::is_same_v<lax::value_t<int, 101>::value_type, int>); |
16 | | -static_assert( |
17 | | - std::is_same_v<lax::value_t<unsigned, 101u>::value_type, unsigned>); |
18 | | -static_assert(std::is_same_v<lax::value_t<long, 101l>::value_type, long>); |
19 | | -static_assert(std::is_same_v<lax::value_t<unsigned long, 101ul>::value_type, |
20 | | - unsigned long>); |
21 | | -static_assert( |
22 | | - std::is_same_v<lax::value_t<unsigned long long, 101ull>::value_type, |
23 | | - unsigned long long>); |
24 | | - |
25 | | -static_assert(lax::value_of_v<lax::is_array_m<lax::type_t<int[2]>>>); |
26 | | - |
27 | | -static_assert(lax::value_of_v<lax::not_m<lax::false_t>>); |
28 | | - |
29 | | -static_assert( |
30 | | - lax::value_of_v<lax::gt_m<lax::value_t<int, 2>, lax::value_t<int, 1>>>); |
31 | | - |
32 | | -template <class Value> |
33 | | -struct is_stored_plain_m |
34 | | - : lax::or_m< |
35 | | - lax::and_m< |
36 | | - lax::is_pointer_m<Value>, |
37 | | - lax::lte_m<lax::value_t<size_t, 2>, |
38 | | - lax::alignment_of_m<lax::remove_pointer_m<Value>>>>, |
39 | | - lax::and_m<lax::is_array_m<Value>, |
40 | | - is_stored_plain_m<lax::remove_all_extents_m<Value>>>> {}; |
41 | | - |
42 | | -template <class Value> |
43 | | -static inline constexpr bool is_stored_plain_v = |
44 | | - lax::value_of_v<is_stored_plain_m<lax::type_t<Value>>>; |
45 | | - |
46 | | -static_assert(!is_stored_plain_v<char>); |
47 | | -static_assert(!is_stored_plain_v<char *>); |
48 | | -static_assert(is_stored_plain_v<int *>); |
49 | | -static_assert(is_stored_plain_v<int * [2]>); |
50 | | - |
51 | | -static_assert(lax::value_of_v<lax::if_m<lax::and_m<>, lax::value_t<int, 1>, |
52 | | - lax::value_t<int, 2>>> == 1); |
53 | | - |
54 | | -static_assert(lax::value_of_v<lax::if_m<lax::or_m<>, lax::value_t<int, 1>, |
55 | | - lax::value_t<int, 2>>> == 2); |
56 | | - |
57 | 1 | int main() { return 0; } |
0 commit comments