I looked for this information, but couldn't find it anywhere. Is there a difference between a "template class" and a "class template" or are they just two different ways of saying the same thing ?

Thanks a lot.

9 Years
Discussion Span
Last Post by parchuresunilv

Class Template is the code for generating template classs.


template<typename T> foo { } // class template

foo<int> t; // template class

Votes + Comments
Wasn't worth waiting two YEARS for :(

Template class:
A generic definition or a parameterized class not instantiated until the client provides the needed information. It’s jargon for plain templates.

Class template:
A class template specifies how individual classes can be constructed much like the way a class specifies how individual objects can be constructed. It’s jargon for plain classes.


class template is a template that defines a class

template <typename T> class SomeClass {...}; // this is a class template
template <typename T> int some_function(T&) {...} // this is a function template
A template class is a particular kind of class. There are many kinds of classes, and in particular, template classes are those defined using a class template. Contrast:

SomeClass sc; // SomeClass is an ordinary (non-template) class
SomeClass<int> sc; // SomeClass<int> is a template class

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.