Glossary: Template
A C++ template is a set of statements, typically a
class
header file
and
implementation file,
in which one or more types are parametric. That is to say they are not
explicitly defined but are denoted symbolically. When such code is used the real types of each
parametric type must be supplied and are substituted to produce
compilable code. For example, it is possible to define
a
container
class in which the type of the container is left as a parameter. Then
each time
objects
need to be held in a container, the container template code is used,
supplying the object's type as the parameter. In essence its a rather
sophisticated "cut and paste" with the container class being duplicated
as necessary each time a new contained object type is encountered.
Go Back to the
The Glossary Top Page
If you have any comments about this page please send them to
Nick West