]> git.proxmox.com Git - ceph.git/blame - 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
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/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>
15namespace hana = boost::hana;
16
17
18template <int i>
19auto key() { return hana::test::ct_eq<i>{}; }
20
21template <int i>
22auto val() { return hana::test::ct_eq<-i>{}; }
23
24template <int i, int j>
25auto p() { return ::minimal_product(key<i>(), val<j>()); }
26
27int 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}