I'm struggling with coding explicit specialization of variadic template of member function in a pretty way. The problem is that standard forbids explicit specializations in non-namespace scopes as explained here. MSVC allows such thing, but GCC (and probably some other more standard-respecting compilers) doesn't.
Reproduction of the problem (let's say it's just printing for simplicity)
struct A
{
template<typename ...Args>
A(Args... args) { print(int(args)...); }
template<typename ...Rest>
void print(int first, Rest... rest) const
{
std::cout << first;
print(int(rest)...);
}
template<>
void print(int first) const { std::cout << first; }
};
int main()
{
A(1, 3, 2, 5, 7, 4);
}
In provided link there's much simpler situation mainly because of just one template parameter and lack of 'recursion'. I can't find a way to get this working and in not eyes-bleeding manner.
Besides provided reproduction I also got exactly the same problem, but with constructor which makes this even more complex...