]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/mp_reverse_fold_q.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/algorithm.hpp>
11 #include <boost/mp11/list.hpp>
12 #include <boost/mp11/integral.hpp>
13 #include <boost/mp11/bind.hpp>
14 #include <boost/core/lightweight_test_trait.hpp>
15 #include <type_traits>
23 template<class T1
, class T2
> struct F
{};
27 using boost::mp11::mp_list
;
28 using boost::mp11::mp_reverse_fold_q
;
29 using boost::mp11::mp_quote
;
31 using Q
= mp_quote
<F
>;
34 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_reverse_fold_q
<mp_list
<>, void, Q
>, void>));
35 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_reverse_fold_q
<mp_list
<X1
>, void, Q
>, F
<X1
, void>>));
36 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_reverse_fold_q
<mp_list
<X1
, X2
>, void, Q
>, F
<X1
, F
<X2
, void>>>));
37 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_reverse_fold_q
<mp_list
<X1
, X2
, X3
>, void, Q
>, F
<X1
, F
<X2
, F
<X3
, void>>>>));
38 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_reverse_fold_q
<mp_list
<X1
, X2
, X3
, X4
>, void, Q
>, F
<X1
, F
<X2
, F
<X3
, F
<X4
, void>>>>>));
42 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_reverse_fold_q
<std::tuple
<>, void, Q
>, void>));
43 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_reverse_fold_q
<std::tuple
<X1
>, void, Q
>, F
<X1
, void>>));
44 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_reverse_fold_q
<std::tuple
<X1
, X2
>, void, Q
>, F
<X1
, F
<X2
, void>>>));
45 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_reverse_fold_q
<std::tuple
<X1
, X2
, X3
>, void, Q
>, F
<X1
, F
<X2
, F
<X3
, void>>>>));
46 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_reverse_fold_q
<std::tuple
<X1
, X2
, X3
, X4
>, void, Q
>, F
<X1
, F
<X2
, F
<X3
, F
<X4
, void>>>>>));
49 using boost::mp11::mp_bind
;
50 using boost::mp11::_1
;
51 using boost::mp11::_2
;
53 using boost::mp11::mp_push_back
;
56 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_reverse_fold_q
<std::tuple
<X1
, X2
, X3
, X4
>, mp_list
<>, mp_bind
<mp_push_back
, _2
, _1
>>, mp_list
<X4
, X3
, X2
, X1
>>));
59 using boost::mp11::mp_push_front
;
62 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_reverse_fold_q
<std::tuple
<X1
, X2
, X3
, X4
>, mp_list
<>, mp_bind
<mp_push_front
, _2
, _1
>>, mp_list
<X1
, X2
, X3
, X4
>>));
65 return boost::report_errors();