DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Instantiating C++ templates

Manual instantiation

Manual instantiation is best done by using the C++ language's explicit instantiation directive, since this method is portable across compiler systems. A simple example is:

   class Baseball { };
   

template<class T> class Roster { };

template class Roster<Baseball>; // explicit instantiation

Manual instantiation can also be controlled through the use of #pragma instantiate, or via the command line through the use of the -T option to CC.


Next topic: Pragma interface
Previous topic: Coding standards for template definitions

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004