]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/mp_find.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / mp11 / test / mp_find.cpp
1
2 // Copyright 2015 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/mp11/integral.hpp>
13 #include <boost/core/lightweight_test_trait.hpp>
14 #include <type_traits>
15 #include <tuple>
16 #include <utility>
17
18 struct X1 {};
19 struct X2 {};
20 struct X3 {};
21
22 int main()
23 {
24 using boost::mp11::mp_list;
25 using boost::mp11::mp_find;
26 using boost::mp11::mp_size_t;
27
28 {
29 using L1 = mp_list<>;
30
31 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_find<L1, void>, mp_size_t<0>>));
32
33 using L2 = mp_list<X1, X2, X2, X3, X3, X3>;
34
35 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_find<L2, void>, mp_size_t<6>>));
36 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_find<L2, X1>, mp_size_t<0>>));
37 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_find<L2, X2>, mp_size_t<1>>));
38 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_find<L2, X3>, mp_size_t<3>>));
39 }
40
41 {
42 using L3 = std::tuple<>;
43
44 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_find<L3, void>, mp_size_t<0>>));
45
46 using L4 = std::tuple<X1, X2, X2, X3, X3, X3>;
47
48 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_find<L4, void>, mp_size_t<6>>));
49 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_find<L4, X1>, mp_size_t<0>>));
50 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_find<L4, X2>, mp_size_t<1>>));
51 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_find<L4, X3>, mp_size_t<3>>));
52 }
53
54 {
55 using L5 = std::pair<X1, X2>;
56
57 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_find<L5, void>, mp_size_t<2>>));
58 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_find<L5, X1>, mp_size_t<0>>));
59 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_find<L5, X2>, mp_size_t<1>>));
60 }
61
62 return boost::report_errors();
63 }