]>
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
11 #pragma warning( disable: 4804 ) // '>=': unsafe use of type 'bool' in operation
14 #include <boost/mp11/algorithm.hpp>
15 #include <boost/mp11/list.hpp>
16 #include <boost/mp11/integral.hpp>
17 #include <boost/core/lightweight_test_trait.hpp>
18 #include <type_traits>
30 using boost::mp11::mp_list
;
31 using boost::mp11::mp_replace_at
;
32 using boost::mp11::mp_int
;
33 using boost::mp11::mp_true
;
34 using boost::mp11::mp_false
;
37 using L
= mp_list
<X1
, X2
, X3
, X4
, X5
>;
39 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<0>, void>, mp_list
<void, X2
, X3
, X4
, X5
>>));
40 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<1>, void>, mp_list
<X1
, void, X3
, X4
, X5
>>));
41 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<2>, void>, mp_list
<X1
, X2
, void, X4
, X5
>>));
42 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<3>, void>, mp_list
<X1
, X2
, X3
, void, X5
>>));
43 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<4>, void>, mp_list
<X1
, X2
, X3
, X4
, void>>));
47 using L
= std::tuple
<X1
, X2
, X3
, X4
, X5
>;
49 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<0>, void>, std::tuple
<void, X2
, X3
, X4
, X5
>>));
50 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<1>, void>, std::tuple
<X1
, void, X3
, X4
, X5
>>));
51 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<2>, void>, std::tuple
<X1
, X2
, void, X4
, X5
>>));
52 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<3>, void>, std::tuple
<X1
, X2
, X3
, void, X5
>>));
53 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_int
<4>, void>, std::tuple
<X1
, X2
, X3
, X4
, void>>));
57 using L
= std::pair
<X1
, X2
>;
59 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_false
, void>, std::pair
<void, X2
>>));
60 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_replace_at
<L
, mp_true
, void>, std::pair
<X1
, void>>));
63 return boost::report_errors();