Overloaded function as argument of variadic template function
问题 I'm trying to make variadic template function, which takes as arguments overloaded function and its arguments :) int sumall(int a) { return a; } int sumall(int a, int b) { return a+b; } template<typename R, typename... A> R doit( R(*f)(A...), A... a) { return f(a...); } I want to call doit without any template specifiers nor casting: cout << doit(sumall, 7, 6) << endl That doesn't compile, but when return types are void, everything work perfect: void printsum(int a) { cout << a << endl; }