Why can’t the compiler figure out these template parameters? Is there a way to make it do so?
(I’m using Visual Studio 2010.)
template<typename T, typename TFunc>
void call(TFunc func) { func(T()); }
void myfunc(void *) { }
int main() { call(myfunc); }
Tappears nowhere in the parameter list soTcannot be deduced from the function arguments. All types to be deduced must appear in deduced contexts in the parameter list. For example,