Summary

Section 18.1 Introduction

  • Templates enable us to specify a range of related (overloaded) functions—called function-template specializations (p. 785)—or a range of related classes—called class-template specializations (p. 785).

Section 18.2 Class Templates

  • Class templates provide the means for describing a class generically and for instantiating classes that are type-specific versions of this generic class.

  • Class templates are called parameterized types (p. 785); they require type parameters to specify how to customize a generic class template to form a specific class-template specialization.

  • To use class-template specializations you write one class template. When you need a new type-specific class, the compiler writes the source ...

Get C++ How to Program, 10/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.