forked from boostorg/mp11
Add test/mp_from_sequence_3.cpp. Refs #103.
This commit is contained in:
@@ -151,6 +151,7 @@ run mp_with_index.cpp ;
|
||||
run mp_with_index_cx.cpp ;
|
||||
run mp_from_sequence.cpp ;
|
||||
run mp_from_sequence_2.cpp ;
|
||||
run mp_from_sequence_3.cpp ;
|
||||
run mp_min_element.cpp ;
|
||||
run mp_min_element_2.cpp ;
|
||||
run mp_min_element_q.cpp ;
|
||||
|
26
test/mp_from_sequence_3.cpp
Normal file
26
test/mp_from_sequence_3.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2017, 2025 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/mp11/algorithm.hpp>
|
||||
#include <boost/core/lightweight_test_trait.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
template<class T, T... I> struct S;
|
||||
|
||||
enum class E { one, two, three };
|
||||
|
||||
template<E e> using constant = std::integral_constant<E, e>;
|
||||
|
||||
int main()
|
||||
{
|
||||
using boost::mp11::mp_list;
|
||||
using boost::mp11::mp_from_sequence;
|
||||
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_from_sequence<S<E>>, mp_list<>>));
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_from_sequence<S<E, E::one>>, mp_list<constant<E::one>>>));
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_from_sequence<S<E, E::one, E::three>>, mp_list<constant<E::one>, constant<E::three>>>));
|
||||
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>>>));
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user