Given the pattern of an invariant function:
template<class T> void f(void(t)(T));
And some simple functions:
void f1(int); void f2(char);
It works:
f(f1);
Type t becomes void (*)(int) .
However, the variation analogue:
template<class... T> void f(void(...t)(T));
does not work. Compilers (gcc and clang) complain about inconsistent types void(T) and void (*)(int) . See DEMO .
Note that if * added explicitly, it works as it should:
template<class... T> void f(void(*...t)(T));
So, why can the non-invariant decompose the type of function, and the variable can not?
source share