]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/tuple/cnstr.convert_copy.cpp
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>
7 namespace hana
= boost::hana
;
12 constexpr A(int i
) : id_(i
) {}
13 friend constexpr bool operator==(const A
& x
, const A
& y
)
14 { return x
.id_
== y
.id_
; }
19 explicit B(int i
) : id_(i
) {}
24 constexpr explicit C(int i
) : id_(i
) {}
25 friend constexpr bool operator==(const C
& x
, const C
& y
)
26 { return x
.id_
== y
.id_
; }
30 explicit D(int i
) : B(i
) {}
36 using T0
= hana::tuple
<double>;
37 using T1
= hana::tuple
<int>;
40 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<0>(t1
) == 2);
43 using T0
= hana::tuple
<double>;
44 using T1
= hana::tuple
<A
>;
47 static_assert(hana::at_c
<0>(t1
) == 2, "");
50 using T0
= hana::tuple
<int>;
51 using T1
= hana::tuple
<C
>;
54 static_assert(hana::at_c
<0>(t1
) == C(2), "");
57 using T0
= hana::tuple
<double, char>;
58 using T1
= hana::tuple
<int, int>;
61 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<0>(t1
) == 2);
62 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<1>(t1
) == int('a'));
65 using T0
= hana::tuple
<double, char, D
>;
66 using T1
= hana::tuple
<int, int, B
>;
67 T0
t0(2.5, 'a', 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);
75 using T0
= hana::tuple
<double, char, D
&>;
76 using T1
= hana::tuple
<int, int, B
&>;
80 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<0>(t1
) == 2);
81 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<1>(t1
) == int('a'));
82 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<2>(t1
).id_
== 2);
85 using T0
= hana::tuple
<double, char, int>;
86 using T1
= hana::tuple
<int, int, B
>;
89 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<0>(t1
) == 2);
90 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<1>(t1
) == int('a'));
91 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<2>(t1
).id_
== 3);