]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/mp_from_sequence.cpp
2 // Copyright 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/integral.hpp>
12 #include <boost/mp11/integer_sequence.hpp>
13 #include <boost/core/lightweight_test_trait.hpp>
14 #include <type_traits>
16 template<class T
, T
... I
> struct S
;
20 using boost::mp11::mp_list
;
21 using boost::mp11::mp_from_sequence
;
22 using boost::mp11::mp_int
;
23 using boost::mp11::mp_size_t
;
24 using boost::mp11::make_integer_sequence
;
25 using boost::mp11::make_index_sequence
;
27 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_from_sequence
<S
<int>>, mp_list
<>>));
28 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_from_sequence
<S
<int, 1>>, mp_list
<mp_int
<1>>>));
29 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_from_sequence
<S
<int, 1, 3>>, mp_list
<mp_int
<1>, mp_int
<3>>>));
30 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_from_sequence
<S
<int, 1, 3, 5>>, mp_list
<mp_int
<1>, mp_int
<3>, mp_int
<5>>>));
32 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_from_sequence
<make_integer_sequence
<int, 0>>, mp_list
<>>));
33 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_from_sequence
<make_integer_sequence
<int, 1>>, mp_list
<mp_int
<0>>>));
34 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_from_sequence
<make_integer_sequence
<int, 2>>, mp_list
<mp_int
<0>, mp_int
<1>>>));
35 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_from_sequence
<make_integer_sequence
<int, 3>>, mp_list
<mp_int
<0>, mp_int
<1>, mp_int
<2>>>));
37 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_from_sequence
<make_index_sequence
<0>>, mp_list
<>>));
38 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_from_sequence
<make_index_sequence
<1>>, mp_list
<mp_size_t
<0>>>));
39 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_from_sequence
<make_index_sequence
<2>>, mp_list
<mp_size_t
<0>, mp_size_t
<1>>>));
40 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_from_sequence
<make_index_sequence
<3>>, mp_list
<mp_size_t
<0>, mp_size_t
<1>, mp_size_t
<2>>>));
42 return boost::report_errors();