Template type arguments (C++ only)
You cannot use one of the following types as
a template argument for a type template parameter:
- a local type
- a type with no linkage
- an unnamed type
- a type compounded from any of the above types
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() {
f<int()>();
}
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().