Search⌘ K

Understanding Template Terminology

Explore the essential terminology of C++ templates including different template types such as function, class, variable, and alias templates. Understand template parameters like type, non-type, and template templates along with specialization and instantiation methods. This lesson provides a foundational reference for mastering template concepts.

Types of templates

So far in this section, 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, or union keyword). An example is the vector class we wrote in the previous lesson.

  • Variable template is the term used for templated variables, such as the NewLine template from the previous section.

  • ...