]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/test/ext/std/array/at.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / test / ext / std / array / at.cpp
CommitLineData
b32b8144 1// Copyright Louis Dionne 2013-2017
7c673cae
FG
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)
4
5#include <boost/hana/ext/std/array.hpp>
6
7#include <boost/hana/assert.hpp>
8#include <boost/hana/at.hpp>
9
10#include <laws/base.hpp> // for move_only
11
12#include <array>
13namespace hana = boost::hana;
14
15
16int main() {
17 // Check non-const lvalue reference
18 {
19 std::array<int, 2> arr = {{999, 888}};
20 int& i = hana::at_c<0>(arr);
21 BOOST_HANA_RUNTIME_CHECK(i == 999);
22 arr[0] = 333;
23 BOOST_HANA_RUNTIME_CHECK(i == 333);
24 i = 444;
25 BOOST_HANA_RUNTIME_CHECK(arr[0] == 444);
26 }
27
28 // Check const lvalue reference
29 {
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);
33 arr[0] = 333;
34 BOOST_HANA_RUNTIME_CHECK(i == 333);
35 }
36
37 // Check move-only types
38 {
39 std::array<hana::test::move_only, 2> arr{};
40 hana::test::move_only m = hana::at_c<0>(std::move(arr));
41 (void)m;
42 }
43}