unpack.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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/basic_tuple.hpp>
  6. #include <boost/hana/equal.hpp>
  7. #include <boost/hana/unpack.hpp>
  8. #include <laws/base.hpp>
  9. namespace hana = boost::hana;
  10. using hana::test::ct_eq;
  11. int main() {
  12. hana::test::_injection<0> f{};
  13. BOOST_HANA_CONSTANT_CHECK(hana::equal(
  14. hana::unpack(hana::make_basic_tuple(), f),
  15. f()
  16. ));
  17. BOOST_HANA_CONSTANT_CHECK(hana::equal(
  18. hana::unpack(hana::make_basic_tuple(ct_eq<0>{}), f),
  19. f(ct_eq<0>{})
  20. ));
  21. BOOST_HANA_CONSTANT_CHECK(hana::equal(
  22. hana::unpack(hana::make_basic_tuple(ct_eq<0>{}, ct_eq<1>{}), f),
  23. f(ct_eq<0>{}, ct_eq<1>{})
  24. ));
  25. BOOST_HANA_CONSTANT_CHECK(hana::equal(
  26. hana::unpack(hana::make_basic_tuple(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}), f),
  27. f(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})
  28. ));
  29. }