type_foldr1.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright Louis Dionne 2013-2017
  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. #include <boost/hana/detail/type_foldr1.hpp>
  5. #include <type_traits>
  6. namespace hana = boost::hana;
  7. template <typename x, typename state>
  8. struct f {
  9. struct type;
  10. };
  11. template <int>
  12. struct x;
  13. static_assert(std::is_same<
  14. hana::detail::type_foldr1<f, x<0>>::type,
  15. x<0>
  16. >{}, "");
  17. static_assert(std::is_same<
  18. hana::detail::type_foldr1<f, x<0>, x<1>>::type,
  19. f<x<0>, x<1>>::type
  20. >{}, "");
  21. static_assert(std::is_same<
  22. hana::detail::type_foldr1<f, x<0>, x<1>, x<2>>::type,
  23. f<x<0>, f<x<1>, x<2>>::type>::type
  24. >{}, "");
  25. static_assert(std::is_same<
  26. hana::detail::type_foldr1<f, x<0>, x<1>, x<2>, x<3>>::type,
  27. f<x<0>, f<x<1>, f<x<2>, x<3>>::type>::type>::type
  28. >{}, "");
  29. static_assert(std::is_same<
  30. hana::detail::type_foldr1<f, x<0>, x<1>, x<2>, x<3>, x<4>>::type,
  31. f<x<0>, f<x<1>, f<x<2>, f<x<3>, x<4>>::type>::type>::type>::type
  32. >{}, "");
  33. static_assert(std::is_same<
  34. hana::detail::type_foldr1<f, x<0>, x<1>, x<2>, x<3>, x<4>, x<5>>::type,
  35. f<x<0>, f<x<1>, f<x<2>, f<x<3>, f<x<4>, x<5>>::type>::type>::type>::type>::type
  36. >{}, "");
  37. static_assert(std::is_same<
  38. hana::detail::type_foldr1<f, x<0>, x<1>, x<2>, x<3>, x<4>, x<5>, x<6>>::type,
  39. 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
  40. >{}, "");
  41. static_assert(std::is_same<
  42. hana::detail::type_foldr1<f, x<0>, x<1>, x<2>, x<3>, x<4>, x<5>, x<6>, x<7>>::type,
  43. 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
  44. >{}, "");
  45. static_assert(std::is_same<
  46. hana::detail::type_foldr1<f, x<0>, x<1>, x<2>, x<3>, x<4>, x<5>, x<6>, x<7>, x<8>>::type,
  47. 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
  48. >{}, "");
  49. int main() { }