I define a variadic struct like so
template <class T, class... TRest>
struct Opa
{
Opa()
{
std::cout << "Mutiple-arguments template";
}
};
and want to specialize it for the case with 1 argument only as follows
template <>
struct Opa<class T>
{
Opa()
{
std::cout << "One-argument template";
}
};
but compiler just ignores this second struct, and the output from
Opa<int> opa;
Opa<int, int> opa_opa;
is Mutiple-arguments template, Mutiple-arguments template
.
Specifying one-argument template in different ways, e.g.
template <class T>
struct Opa
{...}
resulted in a compilation error. I realize that my question is quite simple, but googling didn't help. So please don't throw rotten tomatoes at me, and thanks for the answers.