Add test/mp_from_sequence_3.cpp. Refs #103.

This commit is contained in:
Peter Dimov
2025-01-07 21:08:55 +02:00
parent 43fd186a8e
commit e2277a5b2e
2 changed files with 27 additions and 0 deletions

View File

@@ -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 ;

View 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();
}