• 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/difference.hpp>
7 #include <boost/hana/equal.hpp>
8 #include <boost/hana/map.hpp>
9 #include <boost/hana/string.hpp>
10 
11 #include <string>
12 namespace hana = boost::hana;
13 
14 
15 static auto m1 = hana::make_map(
16     hana::make_pair(BOOST_HANA_STRING("key1"), hana::type_c<std::string>),
17     hana::make_pair(BOOST_HANA_STRING("key2"), hana::type_c<std::string>)
18 );
19 
20 static auto m2 = hana::make_map(
21     hana::make_pair(BOOST_HANA_STRING("key3"), hana::type_c<std::string>),
22     hana::make_pair(BOOST_HANA_STRING("key4"), hana::type_c<std::string>),
23     hana::make_pair(BOOST_HANA_STRING("key5"), hana::type_c<std::string>)
24 );
25 
26 static auto m3 = hana::make_map(
27     hana::make_pair(BOOST_HANA_STRING("key1"), hana::type_c<std::string>),
28     hana::make_pair(BOOST_HANA_STRING("key4"), hana::type_c<int>),
29     hana::make_pair(BOOST_HANA_STRING("key2"), hana::type_c<long long>)
30 );
31 
main()32 int main() {
33     BOOST_HANA_CONSTANT_CHECK(hana::difference(m1, m2) == m1);
34 
35     BOOST_HANA_CONSTANT_CHECK(hana::difference(m1, m3) == hana::make_map());
36 
37     BOOST_HANA_CONSTANT_CHECK(hana::difference(m3, m1) == hana::make_map(
38         hana::make_pair(BOOST_HANA_STRING("key4"), hana::type_c<int>)
39     ));
40 
41     BOOST_HANA_CONSTANT_CHECK(hana::difference(m2, m3) == hana::make_map(
42         hana::make_pair(BOOST_HANA_STRING("key3"), hana::type_c<std::string>),
43         hana::make_pair(BOOST_HANA_STRING("key5"), hana::type_c<std::string>)
44     ));
45 }
46