| 1 | // Copyright Louis Dionne 2013-2022 |
| 2 | // Distributed under the Boost Software License, Version 1.0. |
| 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) |
| 4 | |
| 5 | #include <boost/hana/detail/type_foldr1.hpp> |
| 6 | |
| 7 | #include <type_traits> |
| 8 | namespace hana = boost::hana; |
| 9 | |
| 10 | |
| 11 | template <typename x, typename state> |
| 12 | struct f { |
| 13 | struct type; |
| 14 | }; |
| 15 | |
| 16 | template <int> |
| 17 | struct x; |
| 18 | |
| 19 | static_assert(std::is_same< |
| 20 | hana::detail::type_foldr1<f, x<0>>::type, |
| 21 | x<0> |
| 22 | >{}, "" ); |
| 23 | |
| 24 | static_assert(std::is_same< |
| 25 | hana::detail::type_foldr1<f, x<0>, x<1>>::type, |
| 26 | f<x<0>, x<1>>::type |
| 27 | >{}, "" ); |
| 28 | |
| 29 | static_assert(std::is_same< |
| 30 | hana::detail::type_foldr1<f, x<0>, x<1>, x<2>>::type, |
| 31 | f<x<0>, f<x<1>, x<2>>::type>::type |
| 32 | >{}, "" ); |
| 33 | |
| 34 | static_assert(std::is_same< |
| 35 | hana::detail::type_foldr1<f, x<0>, x<1>, x<2>, x<3>>::type, |
| 36 | f<x<0>, f<x<1>, f<x<2>, x<3>>::type>::type>::type |
| 37 | >{}, "" ); |
| 38 | |
| 39 | static_assert(std::is_same< |
| 40 | hana::detail::type_foldr1<f, x<0>, x<1>, x<2>, x<3>, x<4>>::type, |
| 41 | f<x<0>, f<x<1>, f<x<2>, f<x<3>, x<4>>::type>::type>::type>::type |
| 42 | >{}, "" ); |
| 43 | |
| 44 | static_assert(std::is_same< |
| 45 | hana::detail::type_foldr1<f, x<0>, x<1>, x<2>, x<3>, x<4>, x<5>>::type, |
| 46 | f<x<0>, f<x<1>, f<x<2>, f<x<3>, f<x<4>, x<5>>::type>::type>::type>::type>::type |
| 47 | >{}, "" ); |
| 48 | |
| 49 | static_assert(std::is_same< |
| 50 | hana::detail::type_foldr1<f, x<0>, x<1>, x<2>, x<3>, x<4>, x<5>, x<6>>::type, |
| 51 | f<x<0>, f<x<1>, f<x<2>, f<x<3>, f<x<4>, f<x<5>, x<6>>::type>::type>::type>::type>::type>::type |
| 52 | >{}, "" ); |
| 53 | |
| 54 | static_assert(std::is_same< |
| 55 | hana::detail::type_foldr1<f, x<0>, x<1>, x<2>, x<3>, x<4>, x<5>, x<6>, x<7>>::type, |
| 56 | f<x<0>, f<x<1>, f<x<2>, f<x<3>, f<x<4>, f<x<5>, f<x<6>, x<7>>::type>::type>::type>::type>::type>::type>::type |
| 57 | >{}, "" ); |
| 58 | |
| 59 | static_assert(std::is_same< |
| 60 | hana::detail::type_foldr1<f, x<0>, x<1>, x<2>, x<3>, x<4>, x<5>, x<6>, x<7>, x<8>>::type, |
| 61 | f<x<0>, f<x<1>, f<x<2>, f<x<3>, f<x<4>, f<x<5>, f<x<6>, f<x<7>, x<8>>::type>::type>::type>::type>::type>::type>::type>::type |
| 62 | >{}, "" ); |
| 63 | |
| 64 | int main() { } |
| 65 | |