]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/mp_assign.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/list.hpp>
11 #include <boost/core/lightweight_test_trait.hpp>
12 #include <type_traits>
22 using boost::mp11::mp_list
;
23 using boost::mp11::mp_assign
;
25 using L1
= mp_list
<int, void(), float[]>;
27 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L1
, mp_list
<>>, mp_list
<>>));
28 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L1
, mp_list
<X1
>>, mp_list
<X1
>>));
29 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L1
, mp_list
<X1
, X2
>>, mp_list
<X1
, X2
>>));
30 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L1
, mp_list
<X1
, X2
, X3
>>, mp_list
<X1
, X2
, X3
>>));
34 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L1
, std::tuple
<>>, mp_list
<>>));
35 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L1
, std::tuple
<X1
>>, mp_list
<X1
>>));
36 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L1
, std::tuple
<X1
, X2
>>, mp_list
<X1
, X2
>>));
37 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L1
, std::tuple
<X1
, X2
, X3
>>, mp_list
<X1
, X2
, X3
>>));
41 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L1
, std::pair
<X1
, X2
>>, mp_list
<X1
, X2
>>));
45 using L2
= std::tuple
<int, char, float>;
47 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L2
, mp_list
<>>, std::tuple
<>>));
48 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L2
, mp_list
<X1
>>, std::tuple
<X1
>>));
49 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L2
, mp_list
<X1
, X2
>>, std::tuple
<X1
, X2
>>));
50 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L2
, mp_list
<X1
, X2
, X3
>>, std::tuple
<X1
, X2
, X3
>>));
52 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L2
, std::pair
<X1
, X2
>>, std::tuple
<X1
, X2
>>));
56 using L3
= std::pair
<int, char>;
58 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L3
, mp_list
<X1
, X2
>>, std::pair
<X1
, X2
>>));
59 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_assign
<L3
, std::pair
<X1
, X2
>>, std::pair
<X1
, X2
>>));
63 return boost::report_errors();