Default template parameters in 2.95

Thomas Matelich sosedada@usa.net
Wed Jul 14 10:09:00 GMT 1999


tom> g++ -v
Reading specs from
/opt/gnu/lib/gcc-lib/hppa1.1-hp-hpux10.20/gcc-2.95/specs
gcc version gcc-2.95 19990708 (prerelease)

I use a Checked_iter nearly verbatim to C++ Prog Lang, 3rd Ed, Sec
19.3.  Here is part of my class declaration:

template <class Cont, class Iterator = typename Cont::iterator >
class Checked_iter : public iterator_traits< Iterator >
{
public:
   typedef Iterator iterator_type;
   typedef Checked_iter<Cont,Iterator> self;

protected:
   iterator_type current;  //iterator for current position
   Cont* c;  //pointer to current container

public:
.
.
.
   friend bool operator==(const self& left, const self& right)
   { return left.c==right.c && left.current==right.current; }
.
.
.
};

I am getting a new error (Since egcs 1.1.2):

iterators.h: In function `bool operator ==(const
Checked_iter<Cont,Iterator> &, const Checked_iter<Cont,Iterator> &)`
iterators.h:32: default argument for template parameter in function
template `operator ==(const Checked_iter<Cont,Iterator> &, const
Checked_iter<Cont,Iterator> &)`

Is it now a problem to define this friend function within the template class?


--
Thomas O Matelich
Senior Software Designer
Zetec, Inc.
sosedada@usa.net
tmatelich@zetec.com

____________________________________________________________________
Get free e-mail and a permanent address at http://www.netaddress.com/?N=1


More information about the Gcc-bugs mailing list