]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/map/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/contains.hpp>
7 #include <boost/hana/equal.hpp>
8 #include <boost/hana/unpack.hpp>
9 #include <boost/hana/map.hpp>
10 #include <boost/hana/permutations.hpp>
11 #include <boost/hana/transform.hpp>
13 #include <laws/base.hpp>
14 #include <support/minimal_product.hpp>
15 #include <support/seq.hpp>
16 namespace hana
= boost::hana
;
20 auto key() { return hana::test::ct_eq
<i
>{}; }
23 auto val() { return hana::test::ct_eq
<-i
>{}; }
25 template <int i
, int j
>
26 auto p() { return ::minimal_product(key
<i
>(), val
<j
>()); }
31 constexpr auto sequence
= ::seq
;
32 hana::test::_injection
<0> f
{};
34 auto check
= [=](auto ...pairs
) {
35 auto possible_results
= hana::transform(hana::permutations(sequence(pairs
...)),
36 [=](auto xs
) { return hana::unpack(xs
, f
); }
39 BOOST_HANA_CONSTANT_CHECK(hana::contains(
41 hana::unpack(hana::make_map(pairs
...), f
)
47 check(p
<1, 1>(), p
<2, 2>());
48 check(p
<1, 1>(), p
<2, 2>(), p
<3, 3>());
49 check(p
<1, 1>(), p
<2, 2>(), p
<3, 3>(), p
<4, 4>());