How do you explicitly instantiate a member function template?

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)