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