]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/ext/std/array/at.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/array.hpp>
7 #include <boost/hana/assert.hpp>
8 #include <boost/hana/at.hpp>
10 #include <laws/base.hpp> // for move_only
13 namespace hana
= boost::hana
;
17 // Check non-const lvalue reference
19 std::array
<int, 2> arr
= {{999, 888}};
20 int& i
= hana::at_c
<0>(arr
);
21 BOOST_HANA_RUNTIME_CHECK(i
== 999);
23 BOOST_HANA_RUNTIME_CHECK(i
== 333);
25 BOOST_HANA_RUNTIME_CHECK(arr
[0] == 444);
28 // Check const lvalue reference
30 std::array
<int, 2> arr
= {{999, 888}};
31 int const& i
= hana::at_c
<0>(static_cast<std::array
<int, 2> const&>(arr
));
32 BOOST_HANA_RUNTIME_CHECK(i
== 999);
34 BOOST_HANA_RUNTIME_CHECK(i
== 333);
37 // Check move-only types
39 std::array
<hana::test::move_only
, 2> arr
{};
40 hana::test::move_only m
= hana::at_c
<0>(std::move(arr
));