devxlogo

The Type of a Class Template

The Type of a Class Template

A template name is not a type. When you need a template functioning as a full type (for example: to serve as a base class or as a function argument), you have to specify its arguments:

 size_t n = sizeof(vector); //compile time error; template argument list is requiredsize_t n = sizeof(vector<int>); //fineclass myCharVector : public vector<char> { //also fine//...};

devx-admin

Share the Post: