• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 static auto m1 = hana::make_map(
17     hana::make_pair(BOOST_HANA_STRING("key1"), hana::type_c<std::string>),
18     hana::make_pair(BOOST_HANA_STRING("key2"), hana::type_c<std::string>)
19 );
20 
21 static auto m2 = hana::make_map(
22     hana::make_pair(BOOST_HANA_STRING("key3"), hana::type_c<std::string>),
23     hana::make_pair(BOOST_HANA_STRING("key4"), hana::type_c<std::string>),
24     hana::make_pair(BOOST_HANA_STRING("key5"), hana::type_c<std::string>)
25 );
26 
27 BOOST_HANA_CONSTANT_CHECK(hana::intersection(m1, m2) == hana::make_map());
28 
29 static 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>, BOOST_HANA_STRING("hana")),
33     hana::make_pair(hana::type_c<float>, hana::int_c<100>)
34 );
35 
36 static 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_HANA_STRING("boost"))
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>, BOOST_HANA_STRING("hana"))
45 ));
46 
main()47 int main() { }
48