From: gyroscope Newsgroups: comp.os.msdos.djgpp Subject: Re: templates in DJGPP Date: Fri, 29 Aug 1997 12:29:24 +1000 Organization: University of Queensland Lines: 53 Message-ID: <34063404.1CA1@student.uq.edu.au> References: <3400DF67 DOT 3545 AT student DOT uq DOT edu DOT au> <01bcb3bb$95126c00$dfcde7c0 AT JOHNB DOT als DOT ameritech DOT com> Reply-To: s336627 AT student DOT uq DOT edu DOT au NNTP-Posting-Host: s339941.student.uq.edu.au Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk John Bodfish wrote: > > gyroscope wrote in article > <3400DF67 DOT 3545 AT student DOT uq DOT edu DOT au>... > > I am wondering what *exactly* is the syntax for implementing templates in > DJGPP. > > Your example compiles for me. What's your version of gcc? > When I run "gcc -v" I get "gcc version 2.7.2". > > To be real sure your code was working, I added some usage > of the stack class: > > #include > > template > class stack { > public: > T* v; > // etc. > }; > > int main(void) > { > int One = 1; > stack IntStack; > > float Half = 0.5; > stack FloatStack; > > IntStack.v = &One; > FloatStack.v = &Half; > > cout << "One is " << *IntStack.v << endl; > cout << "Half is " << *FloatStack.v << endl; > > return 0; > } > > I compiled this with "gcc -o templates templates.cc -lstdcx" and got > no errors. > > -- > John Bodfish > bodfish AT als DOT ameritech DOT com apologies.. sorry for wasting everyones bandwidth, i've not been using to correct file extensions (ie. no .cc) -Tobias ----------------------------------------------------------------------- ...and all pigs fueled and cleared for take-off -----------------------------------------------------------------------