]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/mp_replace_at.cpp
2 // Copyright 2015, 2017 Peter Dimov.
4 // Distributed under the Boost Software License, Version 1.0.
6 // See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt
10 #include <boost/mp11/algorithm.hpp>
11 #include <boost/mp11/list.hpp>
12 #include <boost/mp11/integral.hpp>
13 #include <boost/core/lightweight_test_trait.hpp>
14 #include <type_traits>
26 using boost::mp11::mp_list
;
27 using boost::mp11::mp_replace_at
;
28 using boost::mp11::mp_int
;
29 using boost::mp11::mp_true
;
30 using boost::mp11::mp_false
;
33 using L
= mp_list
<X1
, X2
, X3
, X4
, X5
>;
35 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<0>, void>, mp_list
<void, X2
, X3
, X4
, X5
>>));
36 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<1>, void>, mp_list
<X1
, void, X3
, X4
, X5
>>));
37 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<2>, void>, mp_list
<X1
, X2
, void, X4
, X5
>>));
38 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<3>, void>, mp_list
<X1
, X2
, X3
, void, X5
>>));
39 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<4>, void>, mp_list
<X1
, X2
, X3
, X4
, void>>));
43 using L
= std::tuple
<X1
, X2
, X3
, X4
, X5
>;
45 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<0>, void>, std::tuple
<void, X2
, X3
, X4
, X5
>>));
46 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<1>, void>, std::tuple
<X1
, void, X3
, X4
, X5
>>));
47 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<2>, void>, std::tuple
<X1
, X2
, void, X4
, X5
>>));
48 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<3>, void>, std::tuple
<X1
, X2
, X3
, void, X5
>>));
49 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<4>, void>, std::tuple
<X1
, X2
, X3
, X4
, void>>));
53 using L
= std::pair
<X1
, X2
>;
55 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_false
, void>, std::pair
<void, X2
>>));
56 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_true
, void>, std::pair
<X1
, void>>));
59 return boost::report_errors();