Skip to content

Commit e2277a5

Browse files
committed
Add test/mp_from_sequence_3.cpp. Refs #103.
1 parent 43fd186 commit e2277a5

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

test/Jamfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ run mp_with_index.cpp ;
151151
run mp_with_index_cx.cpp ;
152152
run mp_from_sequence.cpp ;
153153
run mp_from_sequence_2.cpp ;
154+
run mp_from_sequence_3.cpp ;
154155
run mp_min_element.cpp ;
155156
run mp_min_element_2.cpp ;
156157
run mp_min_element_q.cpp ;

test/mp_from_sequence_3.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2017, 2025 Peter Dimov
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// https://www.boost.org/LICENSE_1_0.txt
4+
5+
#include <boost/mp11/algorithm.hpp>
6+
#include <boost/core/lightweight_test_trait.hpp>
7+
#include <type_traits>
8+
9+
template<class T, T... I> struct S;
10+
11+
enum class E { one, two, three };
12+
13+
template<E e> using constant = std::integral_constant<E, e>;
14+
15+
int main()
16+
{
17+
using boost::mp11::mp_list;
18+
using boost::mp11::mp_from_sequence;
19+
20+
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_from_sequence<S<E>>, mp_list<>>));
21+
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_from_sequence<S<E, E::one>>, mp_list<constant<E::one>>>));
22+
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_from_sequence<S<E, E::one, E::three>>, mp_list<constant<E::one>, constant<E::three>>>));
23+
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_from_sequence<S<E, E::one, E::two, E::three>>, mp_list<constant<E::one>, constant<E::two>, constant<E::three>>>));
24+
25+
return boost::report_errors();
26+
}

0 commit comments

Comments
 (0)