]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/tuple/assign.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)
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/tuple.hpp>
9 namespace hana
= boost::hana
;
14 MoveOnly(MoveOnly
const&) = delete;
15 MoveOnly
& operator=(MoveOnly
const&) = delete;
16 MoveOnly(int data
= 1) : data_(data
) { }
17 MoveOnly(MoveOnly
&& x
) : data_(x
.data_
) { x
.data_
= 0; }
19 MoveOnly
& operator=(MoveOnly
&& x
)
20 { data_
= x
.data_
; x
.data_
= 0; return *this; }
22 int get() const {return data_
;}
23 bool operator==(const MoveOnly
& x
) const { return data_
== x
.data_
; }
24 bool operator< (const MoveOnly
& x
) const { return data_
< x
.data_
; }
29 using T
= hana::tuple
<>;
35 using T
= hana::tuple
<MoveOnly
>;
39 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<0>(t
) == 0);
42 using T
= hana::tuple
<MoveOnly
, MoveOnly
>;
43 T
t0(MoveOnly(0), MoveOnly(1));
46 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<0>(t
) == 0);
47 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<1>(t
) == 1);
50 using T
= hana::tuple
<MoveOnly
, MoveOnly
, MoveOnly
>;
51 T
t0(MoveOnly(0), MoveOnly(1), MoveOnly(2));
54 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<0>(t
) == 0);
55 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<1>(t
) == 1);
56 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<2>(t
) == 2);