The Standard N4296::14.7.1/1 says:
The implicit instantiation of a class template specialization causes the implicit instantiation of the declarations, but not of the definitions, default arguments, or exception-specifications of the class member functions, member classes, scoped member enumerations, static data members and member templates;
Let's then consider the following code:
template <class T>
class A
{
void foo(){ }
};
A<int> a; //Implicit instantiation here
int main(){ }
So, when the template is being implicitly instantiated it actually intstantiated in a class which doesn't have any member function, because we've not used it. Is it true?
Aucun commentaire:
Enregistrer un commentaire