18. Introduction to Custom Templates

Behind that outside pattern the dim shapes get clearer every day. It is always the same shape, only very numerous.

—Charlotte Perkins Gilman

Every man of genius sees the world at a different angle from his fellows.

—Havelock Ellis

...our special individuality, as distinguished from our generic humanity.

—Oliver Wendell Holmes, Sr.

Objectives

In this chapter you’ll:

• Use class templates to create groups of related classes.

• Distinguish between class templates and class-template specializations.

• Learn about nontype template parameters.

• Learn about default template arguments.

• Learn about overloading function templates.

Get C++ How to Program, Ninth Edition 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.