I got a plain variadic template declaration, just like the classic one:
template
class VariadicTemplate;
What
struct Foo {};
#include
template
struct are_same : std::true_type
{};
template
struct are_same
: std::integral_constant{} && are_same{}>
{};
template
class VariadicTemplate
{
static_assert(are_same{}, "a meaningful error message");
};
int main()
{
VariadicTemplate v0{}; (void)v0;
VariadicTemplate v1{}; (void)v1;
}
But something tells me you want to know if the arguments are all specializations of a class template Foo:
template
struct Foo {};
#include
template class T, class U>
struct is_template_of
{
template
static std::true_type test(T*);
static std::false_type test(...);
constexpr static bool value = decltype(test((U*)nullptr)){};
};
template class T, class...>
struct is_template_of_N : std::true_type
{};
template class T, class U, class... TT>
struct is_template_of_N
: std::integral_constant::value
&& is_template_of_N{}>
{};
template
class VariadicTemplate
{
static_assert(is_template_of_N{},
"a meaningful error message");
};
int main()
{
VariadicTemplate, Foo> v0; (void)v0;
VariadicTemplate, int> v1; (void)v1;
}