]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/map/cnstr.move.cpp
b03889171cbe211ac6f40a172ec662d4907bdb2b
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)
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>
13 #include <support/constexpr_move_only.hpp>
14 #include <support/tracked_move_only.hpp>
18 namespace hana
= boost::hana
;
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
));
33 static_assert(in_constexpr_context(), "");
38 auto t0
= hana::make_map();
39 auto t_implicit
= std::move(t0
);
40 auto t_explicit(std::move(t_implicit
));
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
));
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
));
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
));
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"}))