1
0
forked from boostorg/mp11

Add test/mp_set_intersection_sf.cpp

This commit is contained in:
Peter Dimov
2019-01-07 22:45:51 +02:00
parent 311f8bf1a5
commit 614dec90a7
3 changed files with 34 additions and 1 deletions

View File

@ -144,7 +144,7 @@ template<class... S> struct in_all_sets
template<class T> using fn = mp_all< mp_set_contains<S, T>... >;
};
template<class L, class... S> using mp_set_intersection_ = mp_copy_if_q<L, detail::in_all_sets<S...>>;
template<class L, class... S> using mp_set_intersection_ = mp_if< mp_all<mp_is_list<L>, mp_is_list<S>...>, mp_copy_if_q<L, detail::in_all_sets<S...>> >;
template<class... S> struct mp_set_intersection_impl
{

View File

@ -138,6 +138,7 @@ run mp_set_union_sf.cpp ;
run mp_set_difference.cpp ;
run mp_set_difference_sf.cpp ;
run mp_set_intersection.cpp ;
run mp_set_intersection_sf.cpp ;
# function
run mp_all.cpp ;

View File

@ -0,0 +1,32 @@
// Copyright 2019 Peter Dimov.
//
// Distributed under the Boost Software License, Version 1.0.
//
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/mp11/set.hpp>
#include <boost/mp11/utility.hpp>
#include <boost/core/lightweight_test_trait.hpp>
int main()
{
using boost::mp11::mp_set_intersection;
using boost::mp11::mp_valid;
using boost::mp11::mp_list;
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_intersection, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_intersection, void, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_intersection, void, void, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_intersection, void, void, void, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_intersection, void, void, void, void, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_intersection, mp_list<>, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_intersection, mp_list<>, mp_list<>, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_intersection, mp_list<>, mp_list<>, mp_list<>, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_intersection, mp_list<>, mp_list<>, mp_list<>, mp_list<>, void>));
return boost::report_errors();
}