| 27 | using array = T[n]; |
| 28 | |
| 29 | int main() { |
| 30 | // We can't check the laws because builtin arrays can't be passed |
| 31 | // to functions. |
| 32 | |
| 33 | ////////////////////////////////////////////////////////////////////////// |
| 34 | // Foldable |
| 35 | ////////////////////////////////////////////////////////////////////////// |
| 36 | { |
| 37 | int a[] = {1}; |
| 38 | int b[] = {1, 2}; |
| 39 | int c[] = {1, 2, 3}; |
| 40 | int d[] = {1, 2, 3, 4}; |
| 41 | |
| 42 | // unpack |
| 43 | { |
| 44 | hana::test::_injection<0> f{}; |
| 45 | |
| 46 | BOOST_HANA_RUNTIME_CHECK(hana::equal( |
| 47 | hana::unpack(a, f), |
| 48 | f(1) |
| 49 | )); |
| 50 | |
| 51 | BOOST_HANA_RUNTIME_CHECK(hana::equal( |
| 52 | hana::unpack(b, f), |
| 53 | f(1, 2) |
| 54 | )); |
| 55 | |
| 56 | BOOST_HANA_RUNTIME_CHECK(hana::equal( |
| 57 | hana::unpack(c, f), |
| 58 | f(1, 2, 3) |
| 59 | )); |
| 60 | |
| 61 | BOOST_HANA_RUNTIME_CHECK(hana::equal( |
| 62 | hana::unpack(d, f), |
| 63 | f(1, 2, 3, 4) |
| 64 | )); |
| 65 | } |
| 66 | |
| 67 | static_assert(hana::Foldable<int[3]>::value, ""); |
| 68 | } |
| 69 | |
| 70 | ////////////////////////////////////////////////////////////////////////// |
| 71 | // Searchable |
| 72 | ////////////////////////////////////////////////////////////////////////// |
| 73 | { |
| 74 | // any_of |
| 75 | { |
| 76 | static_assert( |
| 77 | hana::not_(hana::any_of(array<int, 1>{0}, hana::equal.to(1))) |
| 78 | , ""); |
| 79 | |
| 80 | static_assert( |
| 81 | hana::any_of(array<int, 2>{0, 1}, hana::equal.to(0)) |
| 82 | , ""); |
| 83 | static_assert( |
| 84 | hana::any_of(array<int, 2>{0, 1}, hana::equal.to(1)) |
| 85 | , ""); |
| 86 | static_assert( |