interop.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  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/core/to.hpp>
  6. #include <boost/hana/equal.hpp>
  7. #include <boost/hana/ext/std/array.hpp>
  8. #include <boost/hana/ext/std/tuple.hpp>
  9. #include <boost/hana/integral_constant.hpp>
  10. #include <boost/hana/range.hpp>
  11. #include <boost/hana/tuple.hpp>
  12. #include <array>
  13. #include <tuple>
  14. namespace hana = boost::hana;
  15. int main() {
  16. static_assert(
  17. hana::to_tuple(std::make_tuple(1, '2', 3.3)) == hana::make_tuple(1, '2', 3.3)
  18. , "");
  19. BOOST_HANA_CONSTANT_CHECK(
  20. hana::to_tuple(hana::make_range(hana::int_c<1>, hana::int_c<4>))
  21. ==
  22. hana::make_tuple(hana::int_c<1>, hana::int_c<2>, hana::int_c<3>)
  23. );
  24. // std::array's operator[] is not constexpr, so we can't use static_assert
  25. BOOST_HANA_CONSTEXPR_CHECK(
  26. hana::to_tuple(std::array<int, 3>{{1, 2, 3}}) == hana::make_tuple(1, 2, 3)
  27. );
  28. }