]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/set/cnstr.trap.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)
5 #include <boost/hana/bool.hpp>
6 #include <boost/hana/detail/wrong.hpp>
7 #include <boost/hana/fwd/hash.hpp>
8 #include <boost/hana/set.hpp>
9 #include <boost/hana/type.hpp>
12 namespace hana
= boost::hana
;
15 // This test makes sure that we do not instantiate rogue constructors when
16 // doing copies and moves
21 Trap(Trap
const&) = default;
22 Trap(Trap
&) = default;
23 Trap(Trap
&&) = default;
27 static_assert(hana::detail::wrong
<X
>{},
28 "this constructor must not be instantiated");
32 template <int i
, int j
>
33 constexpr auto operator==(Trap
<i
> const&, Trap
<j
> const&)
34 { return hana::bool_c
<i
== j
>; }
36 template <int i
, int j
>
37 constexpr auto operator!=(Trap
<i
> const&, Trap
<j
> const&)
38 { return hana::bool_c
<i
!= j
>; }
40 namespace boost
{ namespace hana
{
42 struct hash_impl
<Trap
<i
>> {
43 static constexpr auto apply(Trap
<i
> const&)
44 { return hana::type_c
<Trap
<i
>>; };
50 auto expr
= hana::make_set(Trap
<0>{});
51 auto implicit_copy
= expr
;
52 decltype(expr
) explicit_copy(expr
);
58 auto expr
= hana::make_set(Trap
<0>{});
59 auto implicit_move
= std::move(expr
);
60 decltype(expr
) explicit_move(std::move(implicit_move
));