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)
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/tuple.hpp>
10 namespace hana = boost::hana;
15 explicit B(int i = 0) : id_(i) {}
20 explicit D(int i) : B(i) {}
25 using T0 = hana::tuple<double>;
26 using T1 = hana::tuple<int>;
30 BOOST_HANA_RUNTIME_CHECK(hana::at_c<0>(t1) == 2);
33 using T0 = hana::tuple<double, char>;
34 using T1 = hana::tuple<int, int>;
38 BOOST_HANA_RUNTIME_CHECK(hana::at_c<0>(t1) == 2);
39 BOOST_HANA_RUNTIME_CHECK(hana::at_c<1>(t1) == int('a'));
42 using T0 = hana::tuple<double, char, D>;
43 using T1 = hana::tuple<int, int, B>;
44 T0 t0(2.5, 'a', D(3));
47 BOOST_HANA_RUNTIME_CHECK(hana::at_c<0>(t1) == 2);
48 BOOST_HANA_RUNTIME_CHECK(hana::at_c<1>(t1) == int('a'));
49 BOOST_HANA_RUNTIME_CHECK(hana::at_c<2>(t1).id_ == 3);
54 using T0 = hana::tuple<double, char, D&>;
55 using T1 = hana::tuple<int, int, B&>;
59 BOOST_HANA_RUNTIME_CHECK(hana::at_c<0>(t1) == 2);
60 BOOST_HANA_RUNTIME_CHECK(hana::at_c<1>(t1) == int('a'));
61 BOOST_HANA_RUNTIME_CHECK(hana::at_c<2>(t1).id_ == 2);
64 using T0 = hana::tuple<double, char, std::unique_ptr<D>>;
65 using T1 = hana::tuple<int, int, std::unique_ptr<B>>;
66 T0 t0(2.5, 'a', std::unique_ptr<D>(new D(3)));
69 BOOST_HANA_RUNTIME_CHECK(hana::at_c<0>(t1) == 2);
70 BOOST_HANA_RUNTIME_CHECK(hana::at_c<1>(t1) == int('a'));
71 BOOST_HANA_RUNTIME_CHECK(hana::at_c<2>(t1)->id_ == 3);