The C++ compiler generates the following methods for template instances:
Optionally, you can use the ‘-Ja’ switch to generate all methods.
You can also force all of the out-of-line methods of a template instance to be generated by using the explicit template instantiation syntax defined in the ISO/ANSI C++ Standard. The syntax is:
template class classname<template parameter>;
The following STL example directs the compiler to generate all out-of-line methods for the “list<char>” class, regardless of whether they are referenced by the user’s code:
template class list<char>
You can also explicitly instantiate a single method, or a single static data member of a template class, which means that the method is generated to the .OBJ even though it is not used:
template void classname <template parameter>:: methodname ();
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|