Technical data
Cray Standard C++ Template Instantiation [6]
• A member function name. For example: A<int>::f
• A static data member name. For example: A<int>::i
• A static data declaration. For example: int A<int>::i
• A member function declaration. For example: void A<int>::f(int,
char)
• A template function declaration. For example: char* f(int, float)
A #pragma directive in which the argument is a template class name (for
example, A<int> or class A<int>) is equivalent to repeating the directive
for each member function and static data member declared in the class. When
instantiating an entire class, a given member function or static data member may
be excluded using the #pragma _CRI do_not_instantiate directive. For
example:
#pragma _CRI instantiate A<int>
#pragma _CRI do_not_instantiate A<int>::f
The template definition of a template entity must be present in the compilation
for an instantiation to occur. If an instantiation is explicitly requested by use of
the #pragma instantiate directive and no template definition is available or
a specific definition is provided, an error is issued.
The following example illustrates the use of the #pragma _CRI instantiate
directive:
template <class T> void f1(T); // No body provided
template <class T> void g1(T); // No body provided
void f1(int) {} // Specific definition
void main()
{
int i;
double d;
f1(i);
f1(d);
g1(i);
g1(d);
}
#pragma _CRI instantiate void f1(int) // error-specific definition
#pragma _CRI instantiate void g1(int) // error-no body provided
S–2179–36 115










