]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/tuple/hold_refs.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/tuple.hpp>
8 namespace hana
= boost::hana
;
11 // a non-movable, non-copyable type
14 RefOnly(RefOnly
const&) = delete;
15 RefOnly(RefOnly
&&) = delete;
21 // Make sure we can create a tuple of rvalue references
24 hana::tuple
<RefOnly
&&> xs
{std::move(e
)};
25 hana::tuple
<RefOnly
&&, RefOnly
&&> ys
{std::move(e
), std::move(e
)};
28 hana::tuple
<RefOnly
&&> xs2
= {std::move(e
)};
29 hana::tuple
<RefOnly
&&, RefOnly
&&> ys2
= {std::move(e
), std::move(e
)};
33 // Make sure we can create a tuple of non-const lvalue references
36 hana::tuple
<RefOnly
&> xs
{e
};
37 hana::tuple
<RefOnly
&, RefOnly
&> ys
{e
, e
};
40 hana::tuple
<RefOnly
&> xs2
= {e
};
41 hana::tuple
<RefOnly
&, RefOnly
&> ys2
= {e
, e
};
45 // Make sure we can create a tuple of const lvalue references
48 hana::tuple
<RefOnly
const&> xs
{e
};
49 hana::tuple
<RefOnly
const&, RefOnly
const&> ys
{e
, e
};
52 hana::tuple
<RefOnly
const&> xs2
= {e
};
53 hana::tuple
<RefOnly
const&, RefOnly
const&> ys2
= {e
, e
};
57 // Try to construct tuples with mixed references and non-reference members.
63 hana::tuple
<RefOnly
const&, Empty
> xs
{r
, e
};
64 hana::tuple
<RefOnly
const&, Empty
> ys
= {r
, e
};
68 hana::tuple
<RefOnly
&, Empty
> xs
{r
, e
};
69 hana::tuple
<RefOnly
&, Empty
> ys
= {r
, e
};
73 hana::tuple
<RefOnly
&&, Empty
> xs
{std::move(r
), e
};
74 hana::tuple
<RefOnly
&&, Empty
> ys
= {std::move(r
), e
};