]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/tuple/move_only.cpp
b3c310d7a1b43a7fa6fb02af46bfbf3414edd2b3
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/at.hpp>
6 #include <boost/hana/back.hpp>
7 #include <boost/hana/front.hpp>
8 #include <boost/hana/tuple.hpp>
11 namespace hana
= boost::hana
;
14 // This test checks for move-only friendliness and reference semantics.
18 MoveOnly(MoveOnly
&&) = default;
19 MoveOnly
& operator=(MoveOnly
&&) = default;
21 MoveOnly(MoveOnly
const&) = delete;
22 MoveOnly
& operator=(MoveOnly
const&) = delete;
27 auto xs
= hana::make_tuple(MoveOnly
{});
28 auto by_val
= [](auto) { };
30 by_val(std::move(xs
));
31 by_val(hana::front(std::move(xs
)));
32 by_val(hana::at_c
<0>(std::move(xs
)));
33 by_val(hana::back(std::move(xs
)));
37 auto const& xs
= hana::make_tuple(MoveOnly
{});
38 auto by_const_ref
= [](auto const&) { };
41 by_const_ref(hana::front(xs
));
42 by_const_ref(hana::at_c
<0>(xs
));
43 by_const_ref(hana::back(xs
));
47 auto xs
= hana::make_tuple(MoveOnly
{});
48 auto by_ref
= [](auto&) { };
51 by_ref(hana::front(xs
));
52 by_ref(hana::at_c
<0>(xs
));
53 by_ref(hana::back(xs
));