]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/pair/issue_90.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/first.hpp>
6 #include <boost/hana/pair.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
19 RefOnly(RefOnly
const&) = delete;
20 RefOnly(RefOnly
&&) = delete;
24 // This test makes sure that we return the proper reference types from
25 // `first` and `second`.
26 hana::pair
<RefOnly
, RefOnly
> p
;
29 RefOnly
&& r1
= hana::first(std::move(p
));
30 RefOnly
& r2
= hana::first(p
);
31 RefOnly
const& r3
= hana::first(cref(p
));
33 (void)r1
; (void)r2
; (void)r3
;
37 RefOnly
&& r1
= hana::second(std::move(p
));
38 RefOnly
& r2
= hana::second(p
);
39 RefOnly
const& r3
= hana::second(cref(p
));
41 (void)r1
; (void)r2
; (void)r3
;