This chapter describes the C++ template facility. A template specifies how an individual class, function, or static data member can be constructed by providing a blueprint description of classes or functions within the template.
Unlike an ordinary class or function definition, a template definition contains the template keyword, and uses a type argument, instead of a type, in one or more of the constructs used to define the class or function template. Individual classes or functions can then be generated simply by specifying the template name and by naming the type for the particular class or function as the type argument of the template. You can use templates to define a family of types or functions.
Note: C++ objects with templates can now be linked as a separate step with the IBM C and C++ Compilers linker command.
![]()
Structuring Your Program Using
Templates
Class Templates
![]()
Type Specifiers
Function Templates
Differences between Class and
Function Templates
Member Function Templates
Friends and Templates
Static Data Members and Templates
Template Syntax