special.front.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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/assert.hpp>
  5. #include <boost/hana/equal.hpp>
  6. #include <boost/hana/front.hpp>
  7. #include <boost/hana/integral_constant.hpp>
  8. #include <boost/hana/tuple.hpp>
  9. #include <boost/hana/type.hpp>
  10. namespace hana = boost::hana;
  11. struct x0;
  12. struct x1;
  13. struct x2;
  14. int main() {
  15. // tuple_t
  16. BOOST_HANA_CONSTANT_CHECK(hana::equal(
  17. hana::front(hana::tuple_t<x0>),
  18. hana::type_c<x0>
  19. ));
  20. BOOST_HANA_CONSTANT_CHECK(hana::equal(
  21. hana::front(hana::tuple_t<x0, x1>),
  22. hana::type_c<x0>
  23. ));
  24. BOOST_HANA_CONSTANT_CHECK(hana::equal(
  25. hana::front(hana::tuple_t<x0, x1, x2>),
  26. hana::type_c<x0>
  27. ));
  28. // tuple_c
  29. BOOST_HANA_CONSTANT_CHECK(hana::equal(
  30. hana::front(hana::tuple_c<int, 0>),
  31. hana::int_c<0>
  32. ));
  33. BOOST_HANA_CONSTANT_CHECK(hana::equal(
  34. hana::front(hana::tuple_c<int, 0, 1>),
  35. hana::int_c<0>
  36. ));
  37. BOOST_HANA_CONSTANT_CHECK(hana::equal(
  38. hana::front(hana::tuple_c<int, 0, 1, 2>),
  39. hana::int_c<0>
  40. ));
  41. }