]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/mp_product.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/utility.hpp>
13 #include <boost/core/lightweight_test_trait.hpp>
14 #include <type_traits>
27 template<class T
> struct F1
{};
28 template<class T1
, class T2
, class T3
> struct F3
{};
30 template<class...> struct F
{};
34 using boost::mp11::mp_list
;
35 using boost::mp11::mp_product
;
36 using boost::mp11::mp_product_q
;
37 using boost::mp11::mp_quote
;
40 using L1
= std::tuple
<X1
, X2
, X3
>;
41 using L2
= mp_list
<Y1
>;
42 using L3
= std::pair
<Z1
, Z2
>;
44 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_product
<F3
, L1
, L2
, L3
>, std::tuple
<F3
<X1
, Y1
, Z1
>, F3
<X1
, Y1
, Z2
>, F3
<X2
, Y1
, Z1
>, F3
<X2
, Y1
, Z2
>, F3
<X3
, Y1
, Z1
>, F3
<X3
, Y1
, Z2
>>>));
45 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_product_q
<mp_quote
<F3
>, L1
, L2
, L3
>, std::tuple
<F3
<X1
, Y1
, Z1
>, F3
<X1
, Y1
, Z2
>, F3
<X2
, Y1
, Z1
>, F3
<X2
, Y1
, Z2
>, F3
<X3
, Y1
, Z1
>, F3
<X3
, Y1
, Z2
>>>));
49 using L1
= std::tuple
<X1
, X2
, X3
>;
51 using L3
= std::pair
<Z1
, Z2
>;
53 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_product
<F3
, L1
, L2
, L3
>, std::tuple
<>>));
54 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_product_q
<mp_quote
<F3
>, L1
, L2
, L3
>, std::tuple
<>>));
58 using L1
= std::tuple
<X1
, X2
, X3
>;
59 using L2
= mp_list
<X1
, X2
, X3
>;
61 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_product
<F1
, L1
>, std::tuple
<F1
<X1
>, F1
<X2
>, F1
<X3
>>>));
62 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_product_q
<mp_quote
<F1
>, L1
>, std::tuple
<F1
<X1
>, F1
<X2
>, F1
<X3
>>>));
64 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_product
<F1
, L2
>, mp_list
<F1
<X1
>, F1
<X2
>, F1
<X3
>>>));
65 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_product_q
<mp_quote
<F1
>, L2
>, mp_list
<F1
<X1
>, F1
<X2
>, F1
<X3
>>>));
69 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_product
<F
>, mp_list
<F
<>>>));
70 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_product_q
<mp_quote
<F
>>, mp_list
<F
<>>>));
73 return boost::report_errors();