]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/tuple/unpack.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/equal.hpp>
7 #include <boost/hana/tuple.hpp>
8 #include <boost/hana/type.hpp>
9 #include <boost/hana/unpack.hpp>
11 #include <laws/base.hpp>
12 namespace hana
= boost::hana
;
13 using hana::test::ct_eq
;
16 template <typename
...>
17 struct F
{ struct type
; };
25 hana::test::_injection
<0> f
{};
28 BOOST_HANA_CONSTANT_CHECK(hana::equal(
29 hana::unpack(hana::make_tuple(), f
),
32 BOOST_HANA_CONSTANT_CHECK(hana::equal(
33 hana::unpack(hana::make_tuple(ct_eq
<0>{}), f
),
36 BOOST_HANA_CONSTANT_CHECK(hana::equal(
37 hana::unpack(hana::make_tuple(ct_eq
<0>{}, ct_eq
<1>{}), f
),
38 f(ct_eq
<0>{}, ct_eq
<1>{})
40 BOOST_HANA_CONSTANT_CHECK(hana::equal(
41 hana::unpack(hana::make_tuple(ct_eq
<0>{}, ct_eq
<1>{}, ct_eq
<2>{}), f
),
42 f(ct_eq
<0>{}, ct_eq
<1>{}, ct_eq
<2>{})
46 BOOST_HANA_CONSTANT_CHECK(hana::equal(
47 hana::unpack(hana::tuple_t
<>, f
),
50 BOOST_HANA_CONSTANT_CHECK(hana::equal(
51 hana::unpack(hana::tuple_t
<x0
>, f
),
54 BOOST_HANA_CONSTANT_CHECK(hana::equal(
55 hana::unpack(hana::tuple_t
<x0
, x1
>, f
),
56 f(hana::type_c
<x0
>, hana::type_c
<x1
>)
58 BOOST_HANA_CONSTANT_CHECK(hana::equal(
59 hana::unpack(hana::tuple_t
<x0
, x1
, x2
>, f
),
60 f(hana::type_c
<x0
>, hana::type_c
<x1
>, hana::type_c
<x2
>)
62 BOOST_HANA_CONSTANT_CHECK(hana::equal(
63 hana::unpack(hana::tuple_t
<x0
, x1
, x2
, x3
>, f
),
64 f(hana::type_c
<x0
>, hana::type_c
<x1
>, hana::type_c
<x2
>, hana::type_c
<x3
>)
67 // tuple_t with metafunction
68 auto g
= hana::metafunction
<F
>;
69 BOOST_HANA_CONSTANT_CHECK(hana::equal(
70 hana::unpack(hana::tuple_t
<>, g
),
73 BOOST_HANA_CONSTANT_CHECK(hana::equal(
74 hana::unpack(hana::tuple_t
<x0
>, g
),
77 BOOST_HANA_CONSTANT_CHECK(hana::equal(
78 hana::unpack(hana::tuple_t
<x0
, x1
>, g
),
79 g(hana::type_c
<x0
>, hana::type_c
<x1
>)
81 BOOST_HANA_CONSTANT_CHECK(hana::equal(
82 hana::unpack(hana::tuple_t
<x0
, x1
, x2
>, g
),
83 g(hana::type_c
<x0
>, hana::type_c
<x1
>, hana::type_c
<x2
>)
85 BOOST_HANA_CONSTANT_CHECK(hana::equal(
86 hana::unpack(hana::tuple_t
<x0
, x1
, x2
, x3
>, g
),
87 g(hana::type_c
<x0
>, hana::type_c
<x1
>, hana::type_c
<x2
>, hana::type_c
<x3
>)