Skip to content

Commit d27d821

Browse files
committed
Test mp_fold and mp_reverse_fold with std::pair. Refs #108.
1 parent 50e2a0a commit d27d821

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

test/mp_fold.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
2-
// Copyright 2015 Peter Dimov.
3-
//
1+
// Copyright 2015-2025 Peter Dimov.
42
// Distributed under the Boost Software License, Version 1.0.
5-
//
6-
// See accompanying file LICENSE_1_0.txt or copy at
7-
// http://www.boost.org/LICENSE_1_0.txt
8-
3+
// https://www.boost.org/LICENSE_1_0.txt
94

105
#include <boost/mp11/algorithm.hpp>
116
#include <boost/mp11/list.hpp>
127
#include <boost/mp11/integral.hpp>
138
#include <boost/core/lightweight_test_trait.hpp>
149
#include <type_traits>
1510
#include <tuple>
11+
#include <utility>
1612

1713
struct X1 {};
1814
struct X2 {};
@@ -69,6 +65,10 @@ int main()
6965
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>>));
7066
}
7167

68+
{
69+
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold<std::pair<X1, X2>, void, F>, F<F<void, X1>, X2>>));
70+
}
71+
7272
using boost::mp11::mp_push_back;
7373

7474
{

test/mp_fold_q.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
2-
// Copyright 2015, 2017 Peter Dimov.
3-
//
1+
// Copyright 2015-2025 Peter Dimov.
42
// Distributed under the Boost Software License, Version 1.0.
5-
//
6-
// See accompanying file LICENSE_1_0.txt or copy at
7-
// http://www.boost.org/LICENSE_1_0.txt
8-
3+
// https://www.boost.org/LICENSE_1_0.txt
94

105
#include <boost/mp11/algorithm.hpp>
116
#include <boost/mp11/list.hpp>
@@ -14,6 +9,7 @@
149
#include <boost/core/lightweight_test_trait.hpp>
1510
#include <type_traits>
1611
#include <tuple>
12+
#include <utility>
1713

1814
struct X1 {};
1915
struct X2 {};
@@ -46,6 +42,10 @@ int main()
4642
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>>));
4743
}
4844

45+
{
46+
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fold_q<std::pair<X1, X2>, void, Q>, F<F<void, X1>, X2>>));
47+
}
48+
4949
using boost::mp11::mp_push_back;
5050

5151
{

test/mp_reverse_fold.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
2-
// Copyright 2015-2017 Peter Dimov.
3-
//
1+
// Copyright 2015-2025 Peter Dimov.
42
// Distributed under the Boost Software License, Version 1.0.
5-
//
6-
// See accompanying file LICENSE_1_0.txt or copy at
7-
// http://www.boost.org/LICENSE_1_0.txt
8-
3+
// https://www.boost.org/LICENSE_1_0.txt
94

105
#include <boost/mp11/algorithm.hpp>
116
#include <boost/mp11/list.hpp>
127
#include <boost/mp11/integral.hpp>
138
#include <boost/core/lightweight_test_trait.hpp>
149
#include <type_traits>
1510
#include <tuple>
11+
#include <utility>
1612

1713
struct X1 {};
1814
struct X2 {};
@@ -50,6 +46,10 @@ int main()
5046
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>>>>>));
5147
}
5248

49+
{
50+
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_reverse_fold<std::pair<X1, X2>, void, F>, F<X1, F<X2, void>>>));
51+
}
52+
5353
{
5454
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>>));
5555
}

test/mp_reverse_fold_q.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
2-
// Copyright 2015-2017 Peter Dimov.
3-
//
1+
// Copyright 2015-2017, 2025 Peter Dimov.
42
// Distributed under the Boost Software License, Version 1.0.
5-
//
6-
// See accompanying file LICENSE_1_0.txt or copy at
7-
// http://www.boost.org/LICENSE_1_0.txt
8-
3+
// https://www.boost.org/LICENSE_1_0.txt
94

105
#include <boost/mp11/algorithm.hpp>
116
#include <boost/mp11/list.hpp>
@@ -14,6 +9,7 @@
149
#include <boost/core/lightweight_test_trait.hpp>
1510
#include <type_traits>
1611
#include <tuple>
12+
#include <utility>
1713

1814
struct X1 {};
1915
struct X2 {};
@@ -46,6 +42,10 @@ int main()
4642
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>>>>>));
4743
}
4844

45+
{
46+
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_reverse_fold_q<std::pair<X1, X2>, void, Q>, F<X1, F<X2, void>>>));
47+
}
48+
4949
using boost::mp11::mp_bind;
5050
using boost::mp11::_1;
5151
using boost::mp11::_2;

0 commit comments

Comments
 (0)