]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/map/keys.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / test / map / keys.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)
4
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/contains.hpp>
7 #include <boost/hana/equal.hpp>
8 #include <boost/hana/keys.hpp>
9 #include <boost/hana/map.hpp>
10 #include <boost/hana/permutations.hpp>
11
12 #include <laws/base.hpp>
13 #include <support/seq.hpp>
14 #include <support/minimal_product.hpp>
15 namespace hana = boost::hana;
16
17
18 template <int i>
19 auto key() { return hana::test::ct_eq<i>{}; }
20
21 template <int i>
22 auto val() { return hana::test::ct_eq<-i>{}; }
23
24 template <int i, int j>
25 auto p() { return ::minimal_product(key<i>(), val<j>()); }
26
27 int main() {
28 constexpr auto list = ::seq;
29
30 BOOST_HANA_CONSTANT_CHECK(hana::equal(
31 hana::keys(hana::make_map()),
32 list()
33 ));
34
35 BOOST_HANA_CONSTANT_CHECK(hana::equal(
36 hana::keys(hana::make_map(p<1, 1>())),
37 list(key<1>())
38 ));
39
40 BOOST_HANA_CONSTANT_CHECK(hana::contains(
41 hana::permutations(list(key<1>(), key<2>())),
42 hana::keys(hana::make_map(p<1, 1>(), p<2, 2>()))
43 ));
44
45 BOOST_HANA_CONSTANT_CHECK(hana::contains(
46 hana::permutations(list(key<1>(), key<2>(), key<3>())),
47 hana::keys(hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>()))
48 ));
49 }