Understanding template terminology
So far in this chapter, we have used the general term templates. However, there are four different terms describing the kind of templates we have written:
- Function template is the term used for a templated function. An example is the
max
template seen previously. - Class template is the term used for a templated class (which can be defined either with the
class
,struct
, orunion
keyword). An example is thevector
class we wrote in the previous section. - Variable template is the term used for templated variables, such as the
NewLine
template from the previous section. - Alias template is the term used for templated type aliases. We will see examples for alias templates in the next chapter.
Templates are parameterized with one or more parameters (in the examples we have seen so far, there was a single parameter). These are called template parameters and can be of three categories:
- Type template parameters, such as in
template...