]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/map/intersection.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / map / intersection.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/equal.hpp>
7 #include <boost/hana/intersection.hpp>
8 #include <boost/hana/map.hpp>
9 #include <boost/hana/string.hpp>
10
11 #include <string>
12 namespace hana = boost::hana;
13 using namespace hana::literals;
14
15
16 constexpr auto m1 = hana::make_map(
17 hana::make_pair("key1"_s, hana::type_c<std::string>),
18 hana::make_pair("key2"_s, hana::type_c<std::string>)
19 );
20
21 constexpr auto m2 = hana::make_map(
22 hana::make_pair("key3"_s, hana::type_c<std::string>),
23 hana::make_pair("key4"_s, hana::type_c<std::string>),
24 hana::make_pair("key5"_s, hana::type_c<std::string>)
25 );
26
27 BOOST_HANA_CONSTANT_CHECK(hana::intersection(m1, m2) == hana::make_map());
28
29 constexpr auto m3 = hana::make_map(
30 hana::make_pair(hana::type_c<int>, hana::int_c<1>),
31 hana::make_pair(hana::type_c<bool>, hana::bool_c<true>),
32 hana::make_pair(hana::type_c<std::string>, "hana"_s),
33 hana::make_pair(hana::type_c<float>, hana::int_c<100>)
34 );
35
36 constexpr auto m4 = hana::make_map(
37 hana::make_pair(hana::type_c<char>, hana::char_c<'c'>),
38 hana::make_pair(hana::type_c<bool>, hana::bool_c<false>),
39 hana::make_pair(hana::type_c<std::string>, "boost"_s)
40 );
41
42 BOOST_HANA_CONSTANT_CHECK(hana::intersection(m3, m4) == hana::make_map(
43 hana::make_pair(hana::type_c<bool>, hana::bool_c<true>),
44 hana::make_pair(hana::type_c<std::string>, "hana"_s)
45 ));
46
47 int main() { }