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_partition.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_partition.cpp')
-rw-r--r-- | src/boost/libs/mp11/test/mp_partition.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/boost/libs/mp11/test/mp_partition.cpp b/src/boost/libs/mp11/test/mp_partition.cpp new file mode 100644 index 00000000..8dc1ac2b --- /dev/null +++ b/src/boost/libs/mp11/test/mp_partition.cpp @@ -0,0 +1,50 @@ + +// Copyright 2015 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/core/lightweight_test_trait.hpp> +#include <type_traits> +#include <tuple> + +struct X1 {}; +struct X2 {}; +struct X3 {}; + +int main() +{ + using boost::mp11::mp_list; + using boost::mp11::mp_partition; + + { + using L1 = mp_list<>; + + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_partition<L1, std::is_const>, mp_list<L1, L1>>)); + + using L2 = mp_list<X1, X1 const, X1*, X2 const, X2*, X3*>; + + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_partition<L2, std::is_volatile>, mp_list<L1, L2>>)); + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_partition<L2, std::is_const>, mp_list<mp_list<X1 const, X2 const>, mp_list<X1, X1*, X2*, X3*>>>)); + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_partition<L2, std::is_pointer>, mp_list<mp_list<X1*, X2*, X3*>, mp_list<X1, X1 const, X2 const>>>)); + } + + { + using L1 = std::tuple<>; + + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_partition<L1, std::is_const>, std::tuple<L1, L1>>)); + + using L2 = std::tuple<X1, X1 const, X1*, X2 const, X2*, X3*>; + + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_partition<L2, std::is_volatile>, std::tuple<L1, L2>>)); + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_partition<L2, std::is_const>, std::tuple<std::tuple<X1 const, X2 const>, std::tuple<X1, X1*, X2*, X3*>>>)); + BOOST_TEST_TRAIT_TRUE((std::is_same<mp_partition<L2, std::is_pointer>, std::tuple<std::tuple<X1*, X2*, X3*>, std::tuple<X1, X1 const, X2 const>>>)); + } + + return boost::report_errors(); +} |