www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/29/21:54:51

Newsgroups: comp.os.msdos.djgpp
From: Peter Berdeklis <peter AT atmosp DOT physics DOT utoronto DOT ca>
Subject: Re: Templates in the STL
Message-ID: <Pine.SGI.3.91.970329073728.2783A-100000@atmosp.physics.utoronto.ca>
Nntp-Posting-Host: chinook.physics.utoronto.ca
Sender: news AT info DOT physics DOT utoronto DOT ca (System Administrator)
Mime-Version: 1.0
Organization: University of Toronto - Dept. of Physics
In-Reply-To: <333A86BD.255E@rtp.gtegsc.com>
Date: Sat, 29 Mar 1997 12:40:48 GMT
References: <199703262318 DOT SAA01194 AT delorie DOT com> <333A86BD DOT 255E AT rtp DOT gtegsc DOT com>
Lines: 32
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Thu, 27 Mar 1997, David McKee wrote:

> I have recently downloaded the STL to use as a foundation for 
> my development.  I have not yet used it with DJGPP but I have 
> seen other posts here that it works great.
[snip]

> template <class Result, class Argument = Result>
> struct constant_unary_fun : public unary_function<Argument, Result> {
>   result_type val;
>   constant_unary_fun(const result_type& v) : val(v) {}
>   const result_type& operator()(const argument_type&) const { return
> val; }
> };
> 
> I get errors for the '=' as the compiler syas it is expecting a ','
> or another class, etc.  My question is: Is the = sign in templates
> a new and widely unsupported feature of templates?  If so, does djgpp
> and gcc handle them correctly?  Is there work arounds for this as I 
> am just learning the intracies of templates. 

"class Argument = Result" is a default template argument, and not very 
many compilers support them yet.  They are relatively recent additions to 
the draft standard.  gcc does not support them yet - maybe in version 2.8.0?

By the way, gcc/DJGPP comes with a version of STL.  Use it, since its 
been tweaked to work with gcc.

---------------
Peter Berdeklis
Dept. of Physics, Univ. of Toronto

- Raw text -


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