]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/test/map/unpack.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / test / map / unpack.cpp
CommitLineData
b32b8144 1// Copyright Louis Dionne 2013-2017
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/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>
12
13#include <laws/base.hpp>
14#include <support/minimal_product.hpp>
15#include <support/seq.hpp>
16namespace hana = boost::hana;
17
18
19template <int i>
20auto key() { return hana::test::ct_eq<i>{}; }
21
22template <int i>
23auto val() { return hana::test::ct_eq<-i>{}; }
24
25template <int i, int j>
26auto p() { return ::minimal_product(key<i>(), val<j>()); }
27
28struct undefined { };
29
30int main() {
b32b8144 31 auto sequence = ::seq;
7c673cae
FG
32 hana::test::_injection<0> f{};
33
34 auto check = [=](auto ...pairs) {
35 auto possible_results = hana::transform(hana::permutations(sequence(pairs...)),
36 [=](auto xs) { return hana::unpack(xs, f); }
37 );
38
39 BOOST_HANA_CONSTANT_CHECK(hana::contains(
40 possible_results,
41 hana::unpack(hana::make_map(pairs...), f)
42 ));
43 };
44
45 check();
46 check(p<1, 1>());
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>());
50}