Instantiation of template member function

You can use the following syntax in Class.cpp:

template void Class::function(int);

The template argument can be omitted because of type deduction, which works for function templates. Thus, the above is equivalent to the following, just more concise:

template void Class::function<int>(int);

Notice, that it is not necessary to specify the names of the function parameters – they are not part of a function’s (or function template’s) signature.

Leave a Comment