]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/ext/std/pair/issue_90.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/ext/std/pair.hpp>
6 #include <boost/hana/first.hpp>
7 #include <boost/hana/second.hpp>
10 namespace hana
= boost::hana
;
14 T
const& cref(T
& t
) { return t
; }
16 // a non-movable, non-copyable type
20 RefOnly(RefOnly
const&) = delete;
21 RefOnly(RefOnly
&&) = delete;
25 // This test makes sure that we return the proper reference types from
26 // `first` and `second`.
27 std::pair
<RefOnly
<0>, RefOnly
<1>> p
;
30 RefOnly
<0>&& r1
= hana::first(std::move(p
));
31 RefOnly
<0>& r2
= hana::first(p
);
32 RefOnly
<0> const& r3
= hana::first(cref(p
));
34 (void)r1
; (void)r2
; (void)r3
;
38 RefOnly
<1>&& r1
= hana::second(std::move(p
));
39 RefOnly
<1>& r2
= hana::second(p
);
40 RefOnly
<1> const& r3
= hana::second(cref(p
));
42 (void)r1
; (void)r2
; (void)r3
;