• 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/erase_key.hpp>
7 #include <boost/hana/map.hpp>
8 #include <boost/hana/pair.hpp>
9 #include <boost/hana/string.hpp>
10 #include <boost/hana/type.hpp>
11 
12 #include <string>
13 namespace hana = boost::hana;
14 using namespace std::literals;
15 
16 
main()17 int main() {
18     auto m = hana::make_map(
19         hana::make_pair(hana::type_c<int>, "abcd"s),
20         hana::make_pair(hana::type_c<void>, 1234),
21         hana::make_pair(BOOST_HANA_STRING("foobar!"), hana::type_c<char>)
22     );
23 
24     BOOST_HANA_RUNTIME_CHECK(
25         hana::erase_key(m, BOOST_HANA_STRING("foobar!")) ==
26         hana::make_map(
27             hana::make_pair(hana::type_c<int>, "abcd"s),
28             hana::make_pair(hana::type_c<void>, 1234)
29         )
30     );
31 
32     BOOST_HANA_RUNTIME_CHECK(hana::erase_key(m, hana::type_c<char>) == m);
33 }
34