(C++) Host class

February 24, 2017 · View on GitHub

 

 

 

 

 

(C++) Host class

 

A Host class is a class that takes a template parameter of a policy. Or: a Host 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 Host classes.

 

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

 

 

 

 

 

Examples

 

 

 

 

 

 

References

 

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