Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / hana / test / set / cnstr.move.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)
4
5 #include <boost/hana/bool.hpp>
6 #include <boost/hana/fwd/hash.hpp>
7 #include <boost/hana/set.hpp>
8 #include <boost/hana/type.hpp>
9
10 #include <support/constexpr_move_only.hpp>
11 #include <support/tracked_move_only.hpp>
12
13 #include <utility>
14 namespace hana = boost::hana;
15
16
17 constexpr bool in_constexpr_context() {
18     auto t0 = hana::make_set(ConstexprMoveOnly<2>{}, ConstexprMoveOnly<3>{});
19     auto t_implicit = std::move(t0);
20     auto t_explicit(std::move(t_implicit));
21
22     (void)t_implicit;
23     (void)t_explicit;
24     return true;
25 }
26
27 static_assert(in_constexpr_context(), "");
28
29
30 int main() {
31     {
32         auto t0 = hana::make_set();
33         auto t_implicit = std::move(t0);
34         auto t_explicit(std::move(t_implicit));
35
36         (void)t_explicit;
37         (void)t_implicit;
38     }
39     {
40         auto t0 = hana::make_set(TrackedMoveOnly<1>{});
41         auto t_implicit = std::move(t0);
42         auto t_explicit(std::move(t_implicit));
43
44         (void)t_implicit;
45         (void)t_explicit;
46     }
47     {
48         auto t0 = hana::make_set(TrackedMoveOnly<1>{}, TrackedMoveOnly<2>{});
49         auto t_implicit = std::move(t0);
50         auto t_explicit(std::move(t_implicit));
51
52         (void)t_implicit;
53         (void)t_explicit;
54     }
55     {
56         auto t0 = hana::make_set(TrackedMoveOnly<1>{}, TrackedMoveOnly<2>{}, TrackedMoveOnly<3>{});
57         auto t_implicit = std::move(t0);
58         auto t_explicit(std::move(t_implicit));
59
60         (void)t_implicit;
61         (void)t_explicit;
62     }
63 }