delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/24/22:01:53

From: "Al Combs" <acombs AT uiuc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Templates? What templates?
Date: Fri, 24 Sep 1999 16:09:10 -0500
Organization: University of Illinois at Urbana-Champaign
Message-ID: <7sgp47$svt$1@vixen.cso.uiuc.edu>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990923112447 DOT 10652b-100000 AT is>
NNTP-Posting-Host: spider.cso.uiuc.edu
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
X-Proxy-Client: acombs AT uiuc DOT edu from PPPa20-ResaleChampaign1-4R1141.saturn.bbn.com
Lines: 64
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Ok... here ya go... (BTW, array is a data type w/ a template)

in my array.h file:

template<class Etype>
class Array
{
public:
   Array(void);

private:
   Etype y;
};

in array.C:

#include "array.h"

template<class Etype>
Array<Etype>::Array(void)
{
   y = 0;
}

in main.C:

#include "array.h"

int main(void)
{
Array<int> x;

return 0;
}



The code may not be the best, but I'm still learning. Please help me, if you
can.


Eli Zaretskii wrote in message ...
>
>On Wed, 22 Sep 1999, Al Combs wrote:
>
>> I ws wondering if anyone knows the basic layout for templates using the
g++
>> compiler? I'm in a C++ class, and we use CC to compile. The templates we
>> have to design for CC are not compatable for g++. I need to know how to
>> switch back and forth. I understand CC uses the standard ANSI way. When
is
>> g++ gonna support the standard?
>
>AFAIK, g++ supports the standard.  Please post sample code that is
>accepted by CC (on what platform, btw? CC doesn't tell anything about the
>machine and the OS) but rejected by g++.
>
>Also, what version of g++ are you using?






- Raw text -


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