Chapter Summary
- A template allows a function or class to be parameterized by type
- The template abstracts the actions to be performed
- Template arguments are inferred from the values in a function invocation
- Template functions can have the same name as nontemplate functions. The
nontemplates are searched first for a match
- Template classes allow the creation of containers that work with many
different types of values
- Template classes must be explicitly instantiated in order to declare
new variables
- Template arguments can be type names or they can be constants
- A typedef statement can be used to form an alias for a type
name
- Template arguments can be used to set behavior, for example, setting the
comparison algorithm for sorted containers
prev
|top