]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/map/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/map.hpp>
9 #include <boost/hana/pair.hpp>
10 #include <boost/hana/type.hpp>
13 namespace hana
= boost::hana
;
16 // This test makes sure that we do not instantiate rogue constructors when
17 // doing copies and moves
22 Trap(Trap
const&) = default;
23 Trap(Trap
&) = default;
24 Trap(Trap
&&) = default;
28 static_assert(hana::detail::wrong
<X
>{},
29 "this constructor must not be instantiated");
33 template <int i
, int j
>
34 constexpr auto operator==(Trap
<i
> const&, Trap
<j
> const&)
35 { return hana::bool_c
<i
== j
>; }
37 template <int i
, int j
>
38 constexpr auto operator!=(Trap
<i
> const&, Trap
<j
> const&)
39 { return hana::bool_c
<i
!= j
>; }
41 namespace boost
{ namespace hana
{
43 struct hash_impl
<Trap
<i
>> {
44 static constexpr auto apply(Trap
<i
> const&)
45 { return hana::type_c
<Trap
<i
>>; };
51 auto expr
= hana::make_map(
52 hana::make_pair(Trap
<0>{}, Trap
<0>{})
54 auto implicit_copy
= expr
;
55 decltype(expr
) explicit_copy(expr
);
61 auto expr
= hana::make_map(
62 hana::make_pair(Trap
<0>{}, Trap
<0>{})
64 auto implicit_move
= std::move(expr
);
65 decltype(expr
) explicit_move(std::move(implicit_move
));