Chapter 6. Programming with Templates
When Bjarne Stroustrup worked out the original C++ language design for templates, he referred to them as parameterized types: “parameterized” because they are factored out of the template definition, and “types” because each class or function template typically varies by one or a set of types being operated on or contained. The actual type is later specified by the user.
Stroustrup later changed the name to the more general template. A single template definition serves as a prescription for the automatic generation of a unique instance of a function or class based on a user-specified value or type.
Although we have extensively used class templates, such as the vector and string classes, we haven’t yet implemented ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access