Xref: news-dnh.mv.net comp.os.msdos.djgpp:2985 Path: news-dnh.mv.net!mv!news.sprintlink.net!in2.uu.net!genmagic!goonsquad.spies.com!uuwest!alcyone!max From: max AT alcyone DOT darkside DOT com (Erik Max Francis) Newsgroups: comp.os.msdos.djgpp Subject: Re: Templates in DJGPP. Date: Tue, 31 Oct 95 18:26:44 PST References: Organization: &tSftDotIotE Lines: 43 To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp Andre Krause 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 a1; > // for example > VEKTOR2D a2; > VEKTOR2D 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; > > 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