• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 // Copyright 2016, 2017 Peter Dimov.
3 //
4 // Distributed under the Boost Software License, Version 1.0.
5 //
6 // See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt
8 
9 
10 #include <boost/mp11/map.hpp>
11 #include <boost/mp11/list.hpp>
12 #include <boost/core/lightweight_test_trait.hpp>
13 #include <type_traits>
14 #include <tuple>
15 #include <utility>
16 
main()17 int main()
18 {
19     using boost::mp11::mp_map_erase;
20     using boost::mp11::mp_list;
21 
22     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<mp_list<>, void>, mp_list<>>));
23     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<std::tuple<>, int>, std::tuple<>>));
24 
25     {
26         using M = mp_list<std::pair<int, int const>, std::pair<long, long const>>;
27 
28         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<M, char>, M>));
29         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<M, int>, mp_list<std::pair<long, long const>>>));
30         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<M, long>, mp_list<std::pair<int, int const>>>));
31     }
32 
33     {
34         using M = std::tuple<std::pair<int, int const>, std::pair<long, long const>>;
35 
36         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<M, char>, M>));
37         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<M, int>, std::tuple<std::pair<long, long const>>>));
38         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<M, long>, std::tuple<std::pair<int, int const>>>));
39     }
40 
41     {
42         using M = mp_list<mp_list<int>, mp_list<long, long>, mp_list<long long, long long, long long>>;
43 
44         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<M, char>, M>));
45         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<M, int>, mp_list<mp_list<long, long>, mp_list<long long, long long, long long>>>));
46         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<M, long>, mp_list<mp_list<int>, mp_list<long long, long long, long long>>>));
47         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<M, long long>, mp_list<mp_list<int>, mp_list<long, long>>>));
48     }
49 
50     {
51         using M = std::tuple<mp_list<int>, std::pair<long, long>, std::tuple<long long, long long, long long>>;
52 
53         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<M, char>, M>));
54         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<M, int>, std::tuple<std::pair<long, long>, std::tuple<long long, long long, long long>>>));
55         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<M, long>, std::tuple<mp_list<int>, std::tuple<long long, long long, long long>>>));
56         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_map_erase<M, long long>, std::tuple<mp_list<int>, std::pair<long, long>>>));
57     }
58 
59     return boost::report_errors();
60 }
61