]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/range/unpack.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/assert.hpp>
6 #include <boost/hana/core/make.hpp>
7 #include <boost/hana/core/tag_of.hpp>
8 #include <boost/hana/equal.hpp>
9 #include <boost/hana/integral_constant.hpp>
10 #include <boost/hana/range.hpp>
11 #include <boost/hana/unpack.hpp>
13 #include <laws/base.hpp>
15 #include <type_traits>
16 namespace hana
= boost::hana
;
20 hana::test::_injection
<0> f
{};
22 BOOST_HANA_CONSTANT_CHECK(hana::equal(
23 hana::unpack(hana::make_range(hana::int_c
<0>, hana::int_c
<0>), f
),
26 BOOST_HANA_CONSTANT_CHECK(hana::equal(
27 hana::unpack(hana::make_range(hana::int_c
<0>, hana::int_c
<1>), f
),
30 BOOST_HANA_CONSTANT_CHECK(hana::equal(
31 hana::unpack(hana::make_range(hana::int_c
<0>, hana::int_c
<2>), f
),
32 f(hana::int_c
<0>, hana::int_c
<1>)
34 BOOST_HANA_CONSTANT_CHECK(hana::equal(
35 hana::unpack(hana::make_range(hana::int_c
<0>, hana::int_c
<3>), f
),
36 f(hana::int_c
<0>, hana::int_c
<1>, hana::int_c
<2>)
39 // Previously, we would only unpack with `std::size_t`s. Make
40 // sure this does not happen.
41 hana::unpack(hana::make_range(hana::int_c
<0>, hana::int_c
<1>), [](auto x
) {
42 using T
= hana::tag_of_t
<decltype(x
)>;
43 static_assert(std::is_same
<typename
T::value_type
, int>{}, "");