| 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 | |
| 22 | int main() |
| 23 | { |
| 24 | using boost::mp11::mp_list; |
| 25 | using boost::mp11::mp_replace_third; |
| 26 | |
| 27 | { |
| 28 | using L3 = mp_list<X1, X2, X3>; |
| 29 | |
| 30 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_replace_third<L3, void>, mp_list<X1, X2, void>>)); |
| 31 | |
| 32 | using L4 = mp_list<X1, X2, X3, X4>; |
| 33 | |
| 34 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_replace_third<L4, void>, mp_list<X1, X2, void, X4>>)); |
| 35 | } |
| 36 | |
| 37 | { |
| 38 | using L3 = std::tuple<X1, X2, X3>; |
| 39 | |
| 40 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_replace_third<L3, void>, std::tuple<X1, X2, void>>)); |
| 41 | |
| 42 | using L4 = std::tuple<X1, X2, X3, X4>; |
| 43 | |
| 44 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_replace_third<L4, void>, std::tuple<X1, X2, void, X4>>)); |
| 45 | } |
| 46 | |
| 47 | return boost::report_errors(); |
| 48 | } |
| 49 | |