diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/mp11/test/mp_fold_q.cpp | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/mp11/test/mp_fold_q.cpp')
-rw-r--r-- | src/boost/libs/mp11/test/mp_fold_q.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/boost/libs/mp11/test/mp_fold_q.cpp b/src/boost/libs/mp11/test/mp_fold_q.cpp new file mode 100644 index 00000000..475cf082 --- /dev/null +++ b/src/boost/libs/mp11/test/mp_fold_q.cpp @@ -0,0 +1,62 @@ + +// Copyright 2015, 2017 Peter Dimov. +// +// Distributed under the Boost Software License, Version 1.0. +// +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + + +#include <boost/mp11/algorithm.hpp> +#include <boost/mp11/list.hpp> +#include <boost/mp11/integral.hpp> +#include <boost/mp11/utility.hpp> +#include <boost/core/lightweight_test_trait.hpp> +#include <type_traits> +#include <tuple> + +struct X1 {}; +struct X2 {}; +struct X3 {}; +struct X4 {}; + +template<class T1, class T2> struct F {}; + +int main() +{ + using boost::mp11::mp_list; + using boost::mp11::mp_fold_q; + using boost::mp11::mp_quote; + + using Q = mp_quote<F>; + + { + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold_q<mp_list<>, void, Q>, void>)); + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold_q<mp_list<X1>, void, Q>, F<void, X1>>)); + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold_q<mp_list<X1, X2>, void, Q>, F<F<void, X1>, X2>>)); + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold_q<mp_list<X1, X2, X3>, void, Q>, F<F<F<void, X1>, X2>, X3>>)); + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold_q<mp_list<X1, X2, X3, X4>, void, Q>, F<F<F<F<void, X1>, X2>, X3>, X4>>)); + } + + { + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold_q<std::tuple<>, void, Q>, void>)); + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold_q<std::tuple<X1>, void, Q>, F<void, X1>>)); + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold_q<std::tuple<X1, X2>, void, Q>, F<F<void, X1>, X2>>)); + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold_q<std::tuple<X1, X2, X3>, void, Q>, F<F<F<void, X1>, X2>, X3>>)); + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold_q<std::tuple<X1, X2, X3, X4>, void, Q>, F<F<F<F<void, X1>, X2>, X3>, X4>>)); + } + + using boost::mp11::mp_push_back; + + { + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold_q<std::tuple<X1, X2, X3, X4>, mp_list<>, mp_quote<mp_push_back>>, mp_list<X1, X2, X3, X4>>)); + } + + using boost::mp11::mp_push_front; + + { + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold_q<std::tuple<X1, X2, X3, X4>, mp_list<>, mp_quote<mp_push_front>>, mp_list<X4, X3, X2, X1>>)); + } + + return boost::report_errors(); +} |