The Sun C++ compiler's implementation of templates is different from that of AT&T's Cfront compiler. Cfront uses link-time instantiation, which uses the following algorithm:
Compile all user source files.
Using the prelinker, ptlink, link all object files created in Step 1 into a partially linked executable.
Examine the link output and instantiate all undefined functions for which there are matching templates.
Link all created templates along with the partially linked executable files from Step 2.
As long as there are undefined functions for which there are matching template functions, repeat Steps 3 through 4.
Perform the final pass of the link phase on all created object files.
The main advantage of link-time instantiation is that no special outside support is required to handle specializations (user-provided functions intended to override instantiated template functions). Only those functions that have not been defined in the user source files become targets of instantiation by the compiler.
The two main disadvantages of link-time instantiation are:
Because an instantiation takes place during the link phase, all error messages resulting from an instantiation are deferred until after its use. As a result, there is no helpful traceback of where the error might have occurred.
Repetitive calls to the prelinker can dramatically increase the link time.