]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/tuple/at.rv.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/assert.hpp>
6 #include <boost/hana/tuple.hpp>
8 #include <support/tracked.hpp>
12 namespace hana
= boost::hana
;
17 using T
= hana::tuple
<std::unique_ptr
<int>>;
18 T
t(std::unique_ptr
<int>(new int(3)));
19 std::unique_ptr
<int> p
= hana::at_c
<0>(std::move(t
));
20 BOOST_HANA_RUNTIME_CHECK(*p
== 3);
22 // make sure we don't double-move and do other weird stuff
24 hana::tuple
<Tracked
, Tracked
, Tracked
> xs
{
25 Tracked
{1}, Tracked
{2}, Tracked
{3}
28 Tracked a
= hana::at_c
<0>(std::move(xs
)); (void)a
;
29 Tracked b
= hana::at_c
<1>(std::move(xs
)); (void)b
;
30 Tracked c
= hana::at_c
<2>(std::move(xs
)); (void)c
;
32 // test with nested closures
34 using Inner
= hana::tuple
<Tracked
, Tracked
>;
35 hana::tuple
<Inner
> xs
{Inner
{Tracked
{1}, Tracked
{2}}};
37 Tracked a
= hana::at_c
<0>(hana::at_c
<0>(std::move(xs
))); (void)a
;
38 Tracked b
= hana::at_c
<1>(hana::at_c
<0>(std::move(xs
))); (void)b
;