Note: C++0x is a new version
of the C++ programming language standard. This is a draft standard
and has not been officially adopted in its entirety. The implementation
of C++0x is based on IBM's interpretation of the draft
C++0x standard and is subject to change at any time without notice.
IBM makes no attempt to maintain compatibility with earlier releases
and therefore the C++0x language extension should not be relied on
as a stable programming interface.
Syntactically, an explicit instantiation declaration is
an explicit instantiation definition preceded by the extern keyword,
see Explicit instantiation (C++ only).
Consider the following points when you use the explicit instantiation
declarations feature:
An explicit instantiation declaration of a class template
specialization does not cause implicit instantiation of said specialization.
- In a translation unit, if a user-defined inline function is subject
to an explicit instantiation declaration and not subject to an explicit
instantiation definition:
- Implicit instantiation of said function occurs no matter whether
it is inlined or not.
No out-of-line copy of the function is generated in that
translation unit no matter whether the compiler option -qkeepinlines is
specified or not.
Note: This does not limit the behavior for functions that are
implicitly generated by the compiler. Implicitly declared
special members such as the default constructor, copy constructor,
destructor and copy assignment operator are inline and the compiler
might instantiate them. In particular, out-of-line copies might be
generated.
- The degradation of the amount of inlining achieved on functions
that are not inline and are subject to explicit instantiation declarations
might occur.
- When a non-pure virtual member function is subject to an explicit
instantiation declaration, either directly or through its class, the
virtual member function must be subject to an explicit instantiation
definition somewhere in the entire program. Otherwise, an unresolved
symbol error might result at link time.
- When implicit instantiation of a class template specialization
is allowed, the user program must be written as if the implicit instantiation
of all virtual member functions of that class specialization occurs.
Otherwise, an unresolved symbol error for a virtual member function
might result at link time.
- When implicit instantiation of a class template specialization
is allowed and the specialization is subject to an explicit instantiation
declaration, the class template specialization must be subject to
an explicit instantiation definition somewhere in the user program.
Otherwise, an unresolved symbol error might result at link time.