14. Templates
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 among templates, friends,
inheritance and static members. |
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
Outline |
|
| 14.1 |
Introduction |
| 14.2 |
Function Templates |
| 14.3 |
Overloading Function
Templates |
| 14.4 |
Class Templates |
| 14.5 |
Nontype Parameters and Default
Types for Class Templates |
| 14.6 |
Notes on Templates and
Inheritance |
| 14.7 |
Notes on Templates and
Friends |
| 14.8 |
Notes on Templates and
static Members |
| 14.9 |
Wrap-Up |
|