• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 //  Copyright 2015 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/algorithm.hpp>
11 #include <boost/mp11/list.hpp>
12 #include <boost/core/lightweight_test_trait.hpp>
13 #include <type_traits>
14 #include <tuple>
15 
16 struct X1 {};
17 struct X2 {};
18 struct X3 {};
19 
main()20 int main()
21 {
22     using boost::mp11::mp_list;
23     using boost::mp11::mp_remove;
24 
25     {
26         using L1 = mp_list<>;
27 
28         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_remove<L1, void>, L1>));
29 
30         using L2 = mp_list<X1, X2, X3, X2, X3, X3>;
31 
32         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_remove<L2, void>, L2>));
33         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_remove<L2, X1>, mp_list<X2, X3, X2, X3, X3>>));
34         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_remove<L2, X2>, mp_list<X1, X3, X3, X3>>));
35         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_remove<L2, X3>, mp_list<X1, X2, X2>>));
36     }
37 
38     {
39         using L1 = std::tuple<>;
40 
41         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_remove<L1, void>, L1>));
42 
43         using L2 = std::tuple<X1, X2, X3, X2, X3, X3>;
44 
45         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_remove<L2, void>, L2>));
46         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_remove<L2, X1>, std::tuple<X2, X3, X2, X3, X3>>));
47         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_remove<L2, X2>, std::tuple<X1, X3, X3, X3>>));
48         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_remove<L2, X3>, std::tuple<X1, X2, X2>>));
49     }
50 
51     return boost::report_errors();
52 }
53