delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/29/02:04:54

From: gyroscope <s336627 AT student DOT uq DOT edu DOT au>
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
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

John Bodfish wrote:
> 
> gyroscope <s336627 AT student DOT uq DOT edu DOT au> 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 <ostream.h>
> 
> template<class T>
> class stack {
> public:
>         T* v;
> //      etc.
> };
> 
> int main(void)
> {
>         int One = 1;
>         stack<int> IntStack;
> 
>         float Half = 0.5;
>         stack<float> 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
-----------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019