| 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/equal.hpp> |
| 7 | #include <boost/hana/transform.hpp> |
| 8 | #include <boost/hana/tuple.hpp> |
| 9 | #include <boost/hana/type.hpp> |
| 10 | namespace hana = boost::hana; |
| 11 | |
| 12 | |
| 13 | template <typename ...> |
| 14 | struct F { struct type; }; |
| 15 | |
| 16 | struct x1; |
| 17 | struct x2; |
| 18 | struct x3; |
| 19 | struct x4; |
| 20 | |
| 21 | int main() { |
| 22 | // transform with tuple_t and a metafunction |
| 23 | BOOST_HANA_CONSTANT_CHECK(hana::equal( |
| 24 | hana::transform(hana::tuple_t<>, hana::metafunction<F>), |
| 25 | hana::tuple_t<> |
| 26 | )); |
| 27 | |
| 28 | BOOST_HANA_CONSTANT_CHECK(hana::equal( |
| 29 | hana::transform(hana::tuple_t<x1>, hana::metafunction<F>), |
| 30 | hana::tuple_t<F<x1>::type> |
| 31 | )); |
| 32 | |
| 33 | BOOST_HANA_CONSTANT_CHECK(hana::equal( |
| 34 | hana::transform(hana::tuple_t<x1, x2>, hana::metafunction<F>), |
| 35 | hana::tuple_t<F<x1>::type, F<x2>::type> |
| 36 | )); |
| 37 | |
| 38 | BOOST_HANA_CONSTANT_CHECK(hana::equal( |
| 39 | hana::transform(hana::tuple_t<x1, x2, x3>, hana::metafunction<F>), |
| 40 | hana::tuple_t<F<x1>::type, F<x2>::type, F<x3>::type> |
| 41 | )); |
| 42 | |
| 43 | BOOST_HANA_CONSTANT_CHECK(hana::equal( |
| 44 | hana::transform(hana::tuple_t<x1, x2, x3, x4>, hana::metafunction<F>), |
| 45 | hana::tuple_t<F<x1>::type, F<x2>::type, F<x3>::type, F<x4>::type> |
| 46 | )); |
| 47 | |
| 48 | BOOST_HANA_CONSTANT_CHECK(hana::equal( |
| 49 | hana::transform(hana::tuple_t<x1, x2, x3, x4>, hana::template_<F>), |
| 50 | hana::tuple_t<F<x1>, F<x2>, F<x3>, F<x4>> |
| 51 | )); |
| 52 | } |
| 53 | |