Template type arguments (C++ only)

You cannot use one of the following as a template argument for a type template parameter:

If it is ambiguous whether a template argument is a type or an expression, the template argument is considered to be a type. The following example demonstrates this:

template<class T> void f() { };
template<int i> void f() { };

int main() {

The function call f<int()>() calls the function with T as a template argument - the compiler considers int() as a type - and therefore implicitly instantiates and calls the first f().

Related information