]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/tuple/at.const.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/assert.hpp>
6 #include <boost/hana/tuple.hpp>
9 namespace hana
= boost::hana
;
16 using T
= hana::tuple
<int>;
18 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<0>(t
) == 3);
21 using T
= hana::tuple
<std::string
, int>;
23 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<0>(t
) == "high");
24 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<1>(t
) == 5);
27 using T
= hana::tuple
<double, int>;
28 constexpr T
t(2.718, 5);
29 static_assert(hana::at_c
<0>(t
) == 2.718, "");
30 static_assert(hana::at_c
<1>(t
) == 5, "");
33 using T
= hana::tuple
<Empty
>;
34 constexpr T t
{Empty()};
35 constexpr Empty e
= hana::at_c
<0>(t
); (void)e
;
38 using T
= hana::tuple
<double&, std::string
, int>;
40 const T
t(d
, "high", 5);
41 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<0>(t
) == 1.5);
42 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<1>(t
) == "high");
43 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<2>(t
) == 5);
44 hana::at_c
<0>(t
) = 2.5;
45 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<0>(t
) == 2.5);
46 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<1>(t
) == "high");
47 BOOST_HANA_RUNTIME_CHECK(hana::at_c
<2>(t
) == 5);
48 BOOST_HANA_RUNTIME_CHECK(d
== 2.5);