]>
Commit | Line | Data |
---|---|---|
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) | |
4 | ||
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> | |
12 | ||
13 | #include <laws/base.hpp> | |
14 | ||
15 | #include <type_traits> | |
16 | namespace hana = boost::hana; | |
17 | ||
18 | ||
19 | int main() { | |
20 | hana::test::_injection<0> f{}; | |
21 | ||
22 | BOOST_HANA_CONSTANT_CHECK(hana::equal( | |
23 | hana::unpack(hana::make_range(hana::int_c<0>, hana::int_c<0>), f), | |
24 | f() | |
25 | )); | |
26 | BOOST_HANA_CONSTANT_CHECK(hana::equal( | |
27 | hana::unpack(hana::make_range(hana::int_c<0>, hana::int_c<1>), f), | |
28 | f(hana::int_c<0>) | |
29 | )); | |
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>) | |
33 | )); | |
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>) | |
37 | )); | |
38 | ||
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>{}, ""); | |
44 | }); | |
45 | } |