// class which // results in // implicit
// instantiation
Function Template
Following are examples of explicit and implicit instantiation syntax for a function template:
template <class T> void sort(Array<T> &); // declaration // for the
// sort() // function // template
template <class T> void sort(Array<T> &v) {/* ... */}; // definition // of the
// sort() // function // template
template void sort<char> (Array <char>&); // request to // explicitly // instantiate // the
// sort<char> () // template
// function
//NOTE <char> is not required if
//the compiler can deduce this.
void foo() { |
|
|
|
Array <int> ai; |
|
|
|
sort(ai); | // use of the | sort<int> () | |
} | // | template function which | |
| // | results in | implicit instantiation |
|
|
|
|
NOTE: All template options on an aCC
If you specify more than one option on a
For More Information, refer to the ANSI/ISO C++ International Standard for additional details including explicit specialization syntax.
See “Template Options” (page 91) for more information on
By default,
If there are duplicate instantiations at
The following
aCC
aCC
134 Using HP aC++ Templates