// Instantiation file for the templated Array class // // The following lines trick the compiler into generating linkable // object code out of a template. The compiler will >>NOT<< // generate object code out of a template (ie, "instantiate a // template") >>unless<< it has the class/function implementation // (not just the class definition) available to it in the same file. // Thus, I need to provide the compiler with the templated // class/functions's implementation and then manually instantiate // this class/function. See Section 14.7.2 of the C++ standard. // This is very fugly! #include "Array.cc" // Note that this is the .cc! We will need to // compile this file, not Array.cc // Template instantiations template Array< int >; template Array< const char * >;