]>
Commit | Line | Data |
---|---|---|
f51cf556 | 1 | // Copyright Louis Dionne 2013-2022 |
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/boost/mpl/vector.hpp> | |
6 | ||
7 | #include <boost/hana/assert.hpp> | |
8 | #include <boost/hana/equal.hpp> | |
9 | #include <boost/hana/unpack.hpp> | |
10 | #include <boost/hana/type.hpp> | |
11 | ||
12 | #include <laws/base.hpp> | |
13 | #include <laws/foldable.hpp> | |
14 | ||
15 | #include <boost/mpl/vector.hpp> | |
16 | namespace hana = boost::hana; | |
17 | namespace mpl = boost::mpl; | |
18 | ||
19 | ||
20 | struct t1; struct t2; struct t3; struct t4; | |
21 | ||
22 | int main() { | |
23 | // unpack | |
24 | { | |
25 | hana::test::_injection<0> f{}; | |
26 | BOOST_HANA_CONSTANT_CHECK(hana::equal( | |
27 | hana::unpack(mpl::vector<>{}, f), | |
28 | f() | |
29 | )); | |
30 | ||
31 | BOOST_HANA_CONSTANT_CHECK(hana::equal( | |
32 | hana::unpack(mpl::vector<t1>{}, f), | |
33 | f(hana::type_c<t1>) | |
34 | )); | |
35 | ||
36 | BOOST_HANA_CONSTANT_CHECK(hana::equal( | |
37 | hana::unpack(mpl::vector<t1, t2>{}, f), | |
38 | f(hana::type_c<t1>, hana::type_c<t2>) | |
39 | )); | |
40 | ||
41 | BOOST_HANA_CONSTANT_CHECK(hana::equal( | |
42 | hana::unpack(mpl::vector<t1, t2, t3>{}, f), | |
43 | f(hana::type_c<t1>, hana::type_c<t2>, hana::type_c<t3>) | |
44 | )); | |
45 | } | |
46 | ||
47 | // laws | |
48 | auto vectors = hana::make_tuple( | |
49 | mpl::vector<>{} | |
50 | , mpl::vector<t1>{} | |
51 | , mpl::vector<t1, t2>{} | |
52 | , mpl::vector<t1, t2, t3>{} | |
53 | , mpl::vector<t1, t2, t3, t4>{} | |
54 | ); | |
55 | ||
56 | hana::test::TestFoldable<hana::ext::boost::mpl::vector_tag>{vectors}; | |
57 | } |