]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/map/cnstr.move.cpp
b03889171cbe211ac6f40a172ec662d4907bdb2b
[ceph.git] / ceph / src / boost / libs / hana / test / map / cnstr.move.cpp
1 // Copyright Louis Dionne 2013-2016
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/bool.hpp>
7 #include <boost/hana/equal.hpp>
8 #include <boost/hana/fwd/hash.hpp>
9 #include <boost/hana/map.hpp>
10 #include <boost/hana/pair.hpp>
11 #include <boost/hana/type.hpp>
12
13 #include <support/constexpr_move_only.hpp>
14 #include <support/tracked_move_only.hpp>
15
16 #include <string>
17 #include <utility>
18 namespace hana = boost::hana;
19
20
21 constexpr bool in_constexpr_context() {
22 auto t0 = hana::make_map(
23 hana::make_pair(ConstexprMoveOnly<2>{}, ConstexprMoveOnly<20>{}),
24 hana::make_pair(ConstexprMoveOnly<3>{}, ConstexprMoveOnly<30>{}));
25 auto t_implicit = std::move(t0);
26 auto t_explicit(std::move(t_implicit));
27
28 (void)t_implicit;
29 (void)t_explicit;
30 return true;
31 }
32
33 static_assert(in_constexpr_context(), "");
34
35
36 int main() {
37 {
38 auto t0 = hana::make_map();
39 auto t_implicit = std::move(t0);
40 auto t_explicit(std::move(t_implicit));
41
42 (void)t_explicit;
43 (void)t_implicit;
44 }
45 {
46 auto t0 = hana::make_map(hana::make_pair(TrackedMoveOnly<1>{}, TrackedMoveOnly<10>{}));
47 auto t_implicit = std::move(t0);
48 auto t_explicit(std::move(t_implicit));
49
50 (void)t_implicit;
51 (void)t_explicit;
52 }
53 {
54 auto t0 = hana::make_map(hana::make_pair(TrackedMoveOnly<1>{}, TrackedMoveOnly<10>{}),
55 hana::make_pair(TrackedMoveOnly<2>{}, TrackedMoveOnly<20>{}));
56 auto t_implicit = std::move(t0);
57 auto t_explicit(std::move(t_implicit));
58
59 (void)t_implicit;
60 (void)t_explicit;
61 }
62 {
63 auto t0 = hana::make_map(hana::make_pair(TrackedMoveOnly<1>{}, TrackedMoveOnly<10>{}),
64 hana::make_pair(TrackedMoveOnly<2>{}, TrackedMoveOnly<20>{}),
65 hana::make_pair(TrackedMoveOnly<3>{}, TrackedMoveOnly<30>{}));
66 auto t_implicit = std::move(t0);
67 auto t_explicit(std::move(t_implicit));
68
69 (void)t_implicit;
70 (void)t_explicit;
71 }
72 {
73 auto t0 = hana::make_map(hana::make_pair(hana::int_c<2>, std::string{"abcdef"}));
74 auto moved = std::move(t0);
75 BOOST_HANA_RUNTIME_CHECK(
76 moved == hana::make_map(hana::make_pair(hana::int_c<2>, std::string{"abcdef"}))
77 );
78 }
79 }