Chapter 14. 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 learn:

  • To use function templates to conveniently create a group of related (overloaded) functions.

  • To distinguish between function templates and function-template specializations.

  • To use class templates to create a group of related types.

  • To distinguish between class templates and class-template specializations.

  • To overload function templates.

  • To understand the relationships ...

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