1
0
forked from boostorg/mp11

Add test/mp_set_difference_sf.cpp

This commit is contained in:
Peter Dimov
2019-01-07 21:27:06 +02:00
parent 21a95388f5
commit bc90e79d9f
3 changed files with 36 additions and 1 deletions

View File

@ -13,6 +13,7 @@
#include <boost/mp11/detail/mp_list.hpp>
#include <boost/mp11/detail/mp_append.hpp>
#include <boost/mp11/detail/mp_remove_if.hpp>
#include <boost/mp11/detail/mp_is_list.hpp>
#include <type_traits>
namespace boost
@ -144,7 +145,7 @@ template<class... S> struct in_any_set
} // namespace detail
template<class L, class... S> using mp_set_difference = mp_remove_if_q<L, detail::in_any_set<S...>>;
template<class L, class... S> using mp_set_difference = mp_if< mp_all<mp_is_list<S>...>, mp_remove_if_q<L, detail::in_any_set<S...>> >;
} // namespace mp11
} // namespace boost

View File

@ -136,6 +136,7 @@ run mp_is_set.cpp ;
run mp_set_union.cpp ;
run mp_set_union_sf.cpp ;
run mp_set_difference.cpp ;
run mp_set_difference_sf.cpp ;
# function
run mp_all.cpp ;

View File

@ -0,0 +1,33 @@
// 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_difference;
using boost::mp11::mp_valid;
using boost::mp11::mp_list;
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_difference>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_difference, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_difference, void, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_difference, void, void, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_difference, void, void, void, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_difference, void, void, void, void, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_difference, mp_list<>, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_difference, mp_list<>, mp_list<>, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_difference, mp_list<>, mp_list<>, mp_list<>, void>));
BOOST_TEST_TRAIT_FALSE((mp_valid<mp_set_difference, mp_list<>, mp_list<>, mp_list<>, mp_list<>, void>));
return boost::report_errors();
}