]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/test/basic_tuple/cnstr.copy.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / test / basic_tuple / cnstr.copy.cpp
CommitLineData
b32b8144 1// Copyright Louis Dionne 2013-2017
7c673cae
FG
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>
b32b8144 6#include <boost/hana/at.hpp>
7c673cae
FG
7#include <boost/hana/basic_tuple.hpp>
8
9#include <laws/base.hpp>
10
11#include <string>
12namespace hana = boost::hana;
13
14
15struct Empty { };
16
17int main() {
18 {
19 using T = hana::basic_tuple<>;
20 T t0;
21 T t_implicit = t0;
22 T t_explicit(t0);
23
24 (void)t_explicit;
25 (void)t_implicit;
26 }
27 {
28 using T = hana::basic_tuple<int>;
29 T t0(2);
30 T t = t0;
b32b8144 31 BOOST_HANA_RUNTIME_CHECK(hana::at_c<0>(t) == 2);
7c673cae
FG
32 }
33 {
34 using T = hana::basic_tuple<int, char>;
35 T t0(2, 'a');
36 T t = t0;
b32b8144
FG
37 BOOST_HANA_RUNTIME_CHECK(hana::at_c<0>(t) == 2);
38 BOOST_HANA_RUNTIME_CHECK(hana::at_c<1>(t) == 'a');
7c673cae
FG
39 }
40 {
41 using T = hana::basic_tuple<int, char, std::string>;
42 const T t0(2, 'a', "some text");
43 T t = t0;
b32b8144
FG
44 BOOST_HANA_RUNTIME_CHECK(hana::at_c<0>(t) == 2);
45 BOOST_HANA_RUNTIME_CHECK(hana::at_c<1>(t) == 'a');
46 BOOST_HANA_RUNTIME_CHECK(hana::at_c<2>(t) == "some text");
7c673cae
FG
47 }
48 {
49 using T = hana::basic_tuple<int>;
50 constexpr T t0(2);
51 constexpr T t = t0;
b32b8144 52 static_assert(hana::at_c<0>(t) == 2, "");
7c673cae
FG
53 }
54 {
55 using T = hana::basic_tuple<Empty>;
56 constexpr T t0{};
57 constexpr T t = t0;
b32b8144 58 constexpr Empty e = hana::at_c<0>(t); (void)e;
7c673cae
FG
59 }
60 {
61 struct T { };
62 struct U { };
63
64 constexpr hana::basic_tuple<T, U> binary{};
65 constexpr hana::basic_tuple<T, U> copy_implicit = binary;
66 constexpr hana::basic_tuple<T, U> copy_explicit(binary);
67
68 (void)copy_implicit;
69 (void)copy_explicit;
70 }
71
72 // This used to fail
73 {
74 hana::basic_tuple<
75 hana::test::ct_eq<0>,
76 hana::test::ct_eq<2>,
77 hana::test::ct_eq<4>
78 > tuple{};
79
80 hana::basic_tuple<
81 hana::test::ct_eq<0>,
82 hana::test::ct_eq<2>,
83 hana::test::ct_eq<4>
84 > copy(tuple);
85 }
86}