// Copyright Louis Dionne 2013-2017 // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) #include #include #include #include // for move_only #include namespace hana = boost::hana; int main() { // Check non-const lvalue reference { std::array arr = {{999, 888}}; int& i = hana::at_c<0>(arr); BOOST_HANA_RUNTIME_CHECK(i == 999); arr[0] = 333; BOOST_HANA_RUNTIME_CHECK(i == 333); i = 444; BOOST_HANA_RUNTIME_CHECK(arr[0] == 444); } // Check const lvalue reference { std::array arr = {{999, 888}}; int const& i = hana::at_c<0>(static_cast const&>(arr)); BOOST_HANA_RUNTIME_CHECK(i == 999); arr[0] = 333; BOOST_HANA_RUNTIME_CHECK(i == 333); } // Check move-only types { std::array arr{}; hana::test::move_only m = hana::at_c<0>(std::move(arr)); (void)m; } }