I'm having a problem with this code:
#include <iostream>
using namespace std;
class A {
public:
template<typename T, typename... Args>
void stuff(Args... args);
};
template<typename T, typename... Args>
void A::stuff(Args... args) {
cout << sizeof...(args) << endl;
}
template<>
void A::stuff<int>() {
cout << "int" << endl;
}
int main() {
A a;
A b;
a.stuff<char>();
b.stuff<int>();
}
Trying to compile it, I get this error:
template-id 'stuff<int>' for 'void A::stuff()' does not match any template declaration
What am I doing wrong? I tried it without the variadicness and it worked, but how do I specialise a variadic template member function?