I need a type trait to check whether all types in a parameter pack are copy constructible. This is what I\'ve done so far. The main function contains some test cases, to che
First define a reusable utility to test whether every predicate in a pack is true:
template
struct and_
: std::true_type
{ };
template
struct and_
: std::conditional, std::false_type>::type
{ };
Then it's trivial to use that with is_copy_constructible (or any other unary type trait):
template
using areCopyConstructible = and_...>;
One advantage of defining and_ like this is that it short-circuits, i.e. stops instantiating is_copy_constructible for the rest of the pack after the first false result.