|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
C++ templates enable you to define a family of functions or classes that can operate on different types of information. The Microsoft implementation of C++ templates is based on the ISO/ANSI C++ Standard.
Use templates in situations that result in duplication. For example, you can use function templates to create a set of functions that apply the same algorithm to different data types. Or you can use class templates to develop a set of type-safe classes. Templates are sometimes a better solution than C macros and void pointers, and they are especially useful when working with collections (one of the main uses for templates in MFC) and smart pointers.
What do you want to know more about?
- What templates are
- typename keyword
- Template specifications
- Function templates
- Class templates
- Referencing a template
- When to use templates
- Templates vs. macros
- Templates and smart pointers
- Differences from other implementations
- Learn more about the template-based MFC collection classes
Active Template Library (ATL) | C++ Language Reference