]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/tuple/cnstr.trap.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)
5 #include <boost/hana/tuple.hpp>
8 namespace hana
= boost::hana
;
11 // Make sure that the tuple(Yn&&...) is not preferred over the
12 // tuple(tuple<Yn...> const&) and the tuple(tuple<Yn...>&&)
13 // constructors when copy-constructing a tuple with a single
14 // element that can be constructed from tuple<Yn...> const& and
15 // tuple<Yn...>&&, respectively.
19 Trap1(Trap1
const&) = default;
20 Trap1(Trap1
&) = default;
21 Trap1(Trap1
&&) = default;
25 static_assert(sizeof(X
) && false,
26 "this constructor must not be instantiated");
32 Trap2(Trap2
const&) = default;
33 Trap2(Trap2
&) = default;
34 Trap2(Trap2
&&) = default;
37 Trap2(X
) { // not by reference
38 static_assert(sizeof(X
) && false,
39 "this constructor must not be instantiated");
45 hana::tuple
<Trap1
> tuple
{};
46 hana::tuple
<Trap1
> implicit_copy
= tuple
;
47 hana::tuple
<Trap1
> explicit_copy(tuple
);
48 hana::tuple
<Trap1
> implicit_move
= std::move(tuple
);
49 hana::tuple
<Trap1
> explicit_move(std::move(tuple
));
58 hana::tuple
<Trap2
> tuple
{};
59 hana::tuple
<Trap2
> implicit_copy
= tuple
;
60 hana::tuple
<Trap2
> explicit_copy(tuple
);
61 hana::tuple
<Trap2
> implicit_move
= std::move(tuple
);
62 hana::tuple
<Trap2
> explicit_move(std::move(tuple
));