Skip to content

Latest commit

 

History

History
99 lines (62 loc) · 1.86 KB

File metadata and controls

99 lines (62 loc) · 1.86 KB

 

 

 

 

 

 

A template class is a class that takes a template parameter. Or: a template class defines how a group of classes should be generated, as opposed to a class in C++ as being how the group of objects should be generated:

 


template <class T> struct MyClass {   T x; }; int main() {   MyClass<int> m;   m.x = 10; }

 

Many STL classes are template classes.

 

There is no semantic difference between class and typename in a template-parameter [1].

 

 

 

 

 

Examples

 

 

 

 

 

 

 

  1. C++. International Standard. ISO/IEC 14882. Second edition. Paragraph 14.1.2.