]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/mp_at.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/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_at
;
28 using boost::mp11::mp_at_c
;
29 using boost::mp11::mp_size_t
;
32 using L1
= mp_list
<X1
, X2
, X3
, X4
, X5
>;
34 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at_c
<L1
, 0>, X1
>));
35 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at_c
<L1
, 1>, X2
>));
36 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at_c
<L1
, 2>, X3
>));
37 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at_c
<L1
, 3>, X4
>));
38 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at_c
<L1
, 4>, X5
>));
40 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at
<L1
, mp_size_t
<0>>, X1
>));
41 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at
<L1
, mp_size_t
<1>>, X2
>));
42 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at
<L1
, mp_size_t
<2>>, X3
>));
43 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at
<L1
, mp_size_t
<3>>, X4
>));
44 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at
<L1
, mp_size_t
<4>>, X5
>));
48 using L1
= std::tuple
<X1
, X2
, X3
, X4
, X5
>;
50 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at_c
<L1
, 0>, X1
>));
51 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at_c
<L1
, 1>, X2
>));
52 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at_c
<L1
, 2>, X3
>));
53 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at_c
<L1
, 3>, X4
>));
54 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at_c
<L1
, 4>, X5
>));
56 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at
<L1
, mp_size_t
<0>>, X1
>));
57 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at
<L1
, mp_size_t
<1>>, X2
>));
58 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at
<L1
, mp_size_t
<2>>, X3
>));
59 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at
<L1
, mp_size_t
<3>>, X4
>));
60 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at
<L1
, mp_size_t
<4>>, X5
>));
64 using L1
= std::pair
<X1
, X2
>;
66 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at_c
<L1
, 0>, X1
>));
67 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at_c
<L1
, 1>, X2
>));
69 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at
<L1
, mp_size_t
<0>>, X1
>));
70 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_at
<L1
, mp_size_t
<1>>, X2
>));
73 return boost::report_errors();