How can one check if one parameter pack (interpreted as a set) is a subset of another one?
So far I only have the frame (using std::tuple), but no functionality.
constexpr bool any_of() { return false; }
template
constexpr bool any_of( bool b, Bools... bools ) {
return b || any_of(bools...);
}
constexpr bool all_of() { return true; }
template
constexpr bool all_of( bool b, Bools...bools ) {
return b && all_of(bools...);
}
template
struct contains_t : std::integral_constant::value... )
> {};
template
struct tuple_subset_of;
template
struct tuple_subset_of< std::tuple, std::tuple >:
std::integral_constant::value... )
>
{};
Live example.
This is designed to permit easy improvement post C++17 -- replace any_of and all_of recursive implementations with fold expressions.