Is it possible somehow to do template function specialization like this:
template<typename T, typename... Args>
void Func(size_t id, Args... args) { std::cout << "1\n" }
template<>
void Func<SomeClass>(size_t id, Args... args) { std::cout << "2\n" }
So I want to leave variadic Args, but specify T = SomeClass:
Func<A>(1, 2, 3); // 1
Func<SomeClass>(1, 2); // 2
I know that I can use "little hack" - wrap func into a class and make partial specialization for it, but in my case this doesn't work, because Func() is actually some class method and it initializes some members of this class. So hack-class should has pointer to it and be friend to it (because members is private) which is also problem.
And also this hack looks a little scary and unreadable.
Funcand constrain it usingrequiresas shown here. See working demoif constexprinstead of specializing.