How do I force a particular instance of a C++ template to instantiate?

What you also can try is explicit instantiation:

template class vector<int>;                    // class
template int& vector<int>::operator[](int);    // member
template int convert<int,double>(double);      // function

Leave a Comment