1
2 // Copyright 2015, 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/algorithm.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
17 struct X1 {};
18 struct X2 {};
19 struct X3 {};
20 struct X4 {};
21
main()22 int main()
23 {
24 using boost::mp11::mp_list;
25 using boost::mp11::mp_replace_second;
26
27 {
28 using L2 = mp_list<X1, X2>;
29
30 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_replace_second<L2, void>, mp_list<X1, void>>));
31
32 using L3 = mp_list<X1, X2, X3>;
33
34 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_replace_second<L3, void>, mp_list<X1, void, X3>>));
35
36 using L4 = mp_list<X1, X2, X3, X4>;
37
38 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_replace_second<L4, void>, mp_list<X1, void, X3, X4>>));
39 }
40
41 {
42 using L2 = std::tuple<X1, X2>;
43
44 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_replace_second<L2, void>, std::tuple<X1, void>>));
45
46 using L3 = std::tuple<X1, X2, X3>;
47
48 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_replace_second<L3, void>, std::tuple<X1, void, X3>>));
49
50 using L4 = std::tuple<X1, X2, X3, X4>;
51
52 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_replace_second<L4, void>, std::tuple<X1, void, X3, X4>>));
53 }
54
55 {
56 using L2 = std::pair<X1, X2>;
57
58 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_replace_second<L2, void>, std::pair<X1, void>>));
59 }
60
61 return boost::report_errors();
62 }
63