]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/mp_count.cpp
2 // Copyright 2015 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/detail/config.hpp>
13 # pragma warning( disable: 4503 ) // decorated name length exceeded
16 #include <boost/mp11/algorithm.hpp>
17 #include <boost/mp11/list.hpp>
18 #include <boost/mp11/integral.hpp>
19 #include <boost/core/lightweight_test_trait.hpp>
20 #include <type_traits>
30 using boost::mp11::mp_list
;
31 using boost::mp11::mp_count
;
32 using boost::mp11::mp_size_t
;
37 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_count
<L1
, void>, mp_size_t
<0>>));
39 using L2
= mp_list
<X1
, X2
, X3
, X2
, X3
, X3
>;
41 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_count
<L2
, void>, mp_size_t
<0>>));
42 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_count
<L2
, X1
>, mp_size_t
<1>>));
43 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_count
<L2
, X2
>, mp_size_t
<2>>));
44 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_count
<L2
, X3
>, mp_size_t
<3>>));
48 using L3
= std::tuple
<>;
50 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_count
<L3
, void>, mp_size_t
<0>>));
52 using L4
= std::tuple
<X1
, X2
, X3
, X2
, X3
, X3
>;
54 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_count
<L4
, void>, mp_size_t
<0>>));
55 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_count
<L4
, X1
>, mp_size_t
<1>>));
56 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_count
<L4
, X2
>, mp_size_t
<2>>));
57 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_count
<L4
, X3
>, mp_size_t
<3>>));
61 using L5
= std::pair
<X1
, X2
>;
63 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_count
<L5
, void>, mp_size_t
<0>>));
64 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_count
<L5
, X1
>, mp_size_t
<1>>));
65 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_count
<L5
, X2
>, mp_size_t
<1>>));
69 using boost::mp11::mp_repeat_c
;
73 using L
= mp_repeat_c
<mp_list
<void>, N
>;
74 using R
= mp_count
<L
, void>;
76 BOOST_TEST_TRAIT_TRUE((std::is_same
<R
, mp_size_t
<N
>>));
79 return boost::report_errors();