18.1 Introduction

Templates have become extremely important in writing industrial-strength code. We’ve used templates in Chapters 6, 7 and 1317. In this chapter, we introduce some additional template capabilities and we continue using templates through the rest of the book. Figure 18.1 summarizes our template coverage.

Fig. 18.1 Summary of recursion examples and exercises in the text.

Location in text Discusses
Chapter 6  
Section 6.9 C++11 uniform_int_distribution class template for random-number generation.
Section 6.17 Defining a function template.
Chapter 7 Class templates array and vector for manipulating collections of elements.
Chapter 13  
Section 13.2 The stream-processing classes, which are class templates.

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.