Mail Archives: djgpp/1997/03/29/21:54:51
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 -