]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/mp_remove_if.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>
21 using boost::mp11::mp_bool
;
23 template<class N
> using is_odd
= mp_bool
<N::value
% 2 != 0>;
27 using boost::mp11::mp_list
;
28 using boost::mp11::mp_remove_if
;
33 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_remove_if
<L1
, std::is_const
>, L1
>));
35 using L2
= mp_list
<X1
, X1
const, X1
*, X2
const, X2
*, X3
*>;
37 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_remove_if
<L2
, std::is_volatile
>, L2
>));
38 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_remove_if
<L2
, std::is_const
>, mp_list
<X1
, X1
*, X2
*, X3
*>>));
39 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_remove_if
<L2
, std::is_pointer
>, mp_list
<X1
, X1
const, X2
const>>));
43 using L1
= std::tuple
<>;
45 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_remove_if
<L1
, std::is_const
>, L1
>));
47 using L2
= std::tuple
<X1
, X1
const, X1
*, X2
const, X2
*, X3
*>;
49 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_remove_if
<L2
, std::is_volatile
>, L2
>));
50 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_remove_if
<L2
, std::is_const
>, std::tuple
<X1
, X1
*, X2
*, X3
*>>));
51 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_remove_if
<L2
, std::is_pointer
>, std::tuple
<X1
, X1
const, X2
const>>));
54 using boost::mp11::mp_iota_c
;
55 using boost::mp11::mp_size_t
;
59 using L1
= mp_iota_c
<N
>;
61 using R1
= mp_remove_if
<L1
, is_odd
>;
63 BOOST_TEST_TRAIT_TRUE((std::is_same
<R1
, mp_list
<mp_size_t
<0>, mp_size_t
<2>, mp_size_t
<4>, mp_size_t
<6>, mp_size_t
<8>, mp_size_t
<10>>>));
66 return boost::report_errors();