A template is a concept of compilation time, so of course it will be allowed at compile time (if you mean replacing template parameters). Try passing something that you cannot name as function(2) , for example, some int . This will result in a compile time error. After substituting, your function will look like
int Map(int (*function)(int)){ return function(2); }
You obviously do not need to look for a pointer to a function, because both function(2) and (*function)(2) instantly converted to the so-called function notation. This in itself is wanted again, and you can build an endless chain: (***********function)(2) will still work and will still be the same as function(2) and (*function)(2) .
source share