mirror of
https://github.com/boostorg/mp11.git
synced 2025-12-04 15:59:19 +01:00
Test mp_fold and mp_reverse_fold with std::pair. Refs #108.
This commit is contained in:
@@ -1,11 +1,6 @@
|
|||||||
|
// Copyright 2015-2025 Peter Dimov.
|
||||||
// Copyright 2015 Peter Dimov.
|
|
||||||
//
|
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
//
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
// 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/algorithm.hpp>
|
||||||
#include <boost/mp11/list.hpp>
|
#include <boost/mp11/list.hpp>
|
||||||
@@ -13,6 +8,7 @@
|
|||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
struct X1 {};
|
struct X1 {};
|
||||||
struct X2 {};
|
struct X2 {};
|
||||||
@@ -69,6 +65,10 @@ int main()
|
|||||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold<std::tuple<X1, X2, X3, X4>, void, F>, F<F<F<F<void, X1>, X2>, X3>, X4>>));
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold<std::tuple<X1, X2, X3, X4>, void, F>, F<F<F<F<void, X1>, X2>, X3>, X4>>));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold<std::pair<X1, X2>, void, F>, F<F<void, X1>, X2>>));
|
||||||
|
}
|
||||||
|
|
||||||
using boost::mp11::mp_push_back;
|
using boost::mp11::mp_push_back;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
|
// Copyright 2015-2025 Peter Dimov.
|
||||||
// Copyright 2015, 2017 Peter Dimov.
|
|
||||||
//
|
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
//
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
// 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/algorithm.hpp>
|
||||||
#include <boost/mp11/list.hpp>
|
#include <boost/mp11/list.hpp>
|
||||||
@@ -14,6 +9,7 @@
|
|||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
struct X1 {};
|
struct X1 {};
|
||||||
struct X2 {};
|
struct X2 {};
|
||||||
@@ -46,6 +42,10 @@ int main()
|
|||||||
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>>));
|
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>>));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold_q<std::pair<X1, X2>, void, Q>, F<F<void, X1>, X2>>));
|
||||||
|
}
|
||||||
|
|
||||||
using boost::mp11::mp_push_back;
|
using boost::mp11::mp_push_back;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
|
// Copyright 2015-2025 Peter Dimov.
|
||||||
// Copyright 2015-2017 Peter Dimov.
|
|
||||||
//
|
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
//
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
// 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/algorithm.hpp>
|
||||||
#include <boost/mp11/list.hpp>
|
#include <boost/mp11/list.hpp>
|
||||||
@@ -13,6 +8,7 @@
|
|||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
struct X1 {};
|
struct X1 {};
|
||||||
struct X2 {};
|
struct X2 {};
|
||||||
@@ -50,6 +46,10 @@ int main()
|
|||||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_reverse_fold<std::tuple<X1, X2, X3, X4>, void, F>, F<X1, F<X2, F<X3, F<X4, void>>>>>));
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_reverse_fold<std::tuple<X1, X2, X3, X4>, void, F>, F<X1, F<X2, F<X3, F<X4, void>>>>>));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_reverse_fold<std::pair<X1, X2>, void, F>, F<X1, F<X2, void>>>));
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_reverse_fold<std::tuple<X1, X2, X3, X4>, mp_list<>, rev_push_back>, mp_list<X4, X3, X2, X1>>));
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_reverse_fold<std::tuple<X1, X2, X3, X4>, mp_list<>, rev_push_back>, mp_list<X4, X3, X2, X1>>));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
|
// Copyright 2015-2017, 2025 Peter Dimov.
|
||||||
// Copyright 2015-2017 Peter Dimov.
|
|
||||||
//
|
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
//
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
// 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/algorithm.hpp>
|
||||||
#include <boost/mp11/list.hpp>
|
#include <boost/mp11/list.hpp>
|
||||||
@@ -14,6 +9,7 @@
|
|||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
struct X1 {};
|
struct X1 {};
|
||||||
struct X2 {};
|
struct X2 {};
|
||||||
@@ -46,6 +42,10 @@ int main()
|
|||||||
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>>>>>));
|
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>>>>>));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_reverse_fold_q<std::pair<X1, X2>, void, Q>, F<X1, F<X2, void>>>));
|
||||||
|
}
|
||||||
|
|
||||||
using boost::mp11::mp_bind;
|
using boost::mp11::mp_bind;
|
||||||
using boost::mp11::_1;
|
using boost::mp11::_1;
|
||||||
using boost::mp11::_2;
|
using boost::mp11::_2;
|
||||||
|
|||||||
Reference in New Issue
Block a user