Use templates for specialized functions and classes

One use for the C++ preprocessor was to generate classes and other definitions from templates in order to implement genericity. This is now superseded by the C++ template type facility, which is available in the Taligent C++ Compiler. For information about template conventions, see "Class templates" on page 145.

NOTE For a quick overview of templates, see The C++ Programming Language (Stroustrup), or The C++ Primer (Lippman). Templates are useful whenever you want to define a family of classes or functions that is specialized for a number of different types, rather than one that works with only a single type. They are also extraordinarily useful for generating boilerplate, for example, generating a derived class in a stereotypical way.

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker