HP aC++/HP C A.06.25 Programmer's Guide

5 Using HP aC++ Templates
The following sections overview template processing and describe the instantiation
coding methods available to you.
“Invoking Compile-Time Instantiation” (page 173)
“Scope and Precedence” (page 173)
“Template Processing” (page 173)
“Explicit Instantiation” (page 174)
“Command-Line Option Instantiation” (page 176)
“Compile-Time Instantiation” (page 176)
“Migrating from Automatic Instantiation to Compile-time Instantiation” (page 177)
“C++ Template Tutorial” (page 179)
Invoking Compile-Time Instantiation
There are three methods of invoking compile-time instantiation:
Explicit Instantiation (developer-directed)
Command-Line Option Instantiation (developer-directed)
Compile-Time Instantiation (default)
Scope and Precedence
Explicit instantiation provides instantiation for a particular template class or template
function. While command line options and the default compile-time instantiation
provide instantiation at the level of the translation unit.
If you use explicit instantiation in addition to command-line options or default
instantiation, explicit instantiation takes precedence.
For example, using the +inst_compiletime option requests instantiation of all used
template functions and all static data members and member functions of instantiated
template classes within a translation unit. Using explicit instantiation requests
instantiation of all members of a particular template class or a particular template
function.
Template Processing
In HP aC++, compile-time instantiation is the default template instantiation mechanism.
During compile-time instantiation, the compiler instantiates every template entity it
sees in a translation unit provided it has the required template definition.
Invoking Compile-Time Instantiation 173