Mail Archives: djgpp/1995/11/01/20:16:50
Andre Krause <akrause AT techfak DOT uni-bielefeld DOT de> writes:
> Another Method wich works also for Borland Compilers is the following:
> You append at the very end in the "certain module" a function similiar
> to this:
>
> void __foo()
> {
> CLASSNAME<type> a1;
> // for example
> VEKTOR2D<int> a2;
> VEKTOR2D<float> a3;
> }
>
> this will work with most compilers while the method
True, but this method won't always instantiate overloaded non-member
operator functions.
With DJGPP, I even found that explicitly attempting to invoke some
overloaded non-member operators (such as the insertion operator for
streams, operator <<) won't instantiate the function -- you'll still
get unresolved symbols in the link. For DJGPP, in some circumstances,
you _must_ use some other method (namely the explicit instantiation
you refer to below).
> template VEKTOR2D<int>;
>
> works only for gpp.
I believe that this explicit template instantiation method is at least
a draft standard (I'm not sure about this); it's supported in
CodeWarrior 6 and 7, for instance. (Although I did find a bug with
trying to use this method for instantiation non-member overloaded
operators in CodeWarrior 7 -- it _does_ work without a hitch in DJGPP
in all cases I've tried).
Erik Max Francis, &tSftDotIotE || uuwest!alcyone!max, max AT alcyone DOT darkside DOT com
San Jose, California, U.S.A. || 37 20 07 N 121 53 38 W || the 4th R is respect
H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- || 1love || folasade
_Omnia quia sunt, lumina sunt._ || GIGO Omega Psi || http://www.spies.com/max/
"Hands that once picked cotton can now pick Presidents." -- Jesse Jackson
- Raw text -