共用方式為


Templates in C++: Overview

How Do IDetails

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 WG21/ANSI X3J16 working papers towards the evolving standard for C++.

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 for developing collection classes (one of the main uses for templates in MFC) and smart pointers.

What do you want to know more about?

See Also   Collection Class Topics