This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [MAILER-DAEMON@sourceware.cygnus.com: failure notice]


On Wed, 5 Jul 2000, Yotam Medini wrote:

> On Wed, Jul 05, 2000 at 04:39:50AM -0400, brent verner wrote:
> > On 05 Jul 2000 at 11:24 (+0300), Yotam Medini wrote:
> > | 
> > | It seems that Josuttis's book, SGI's STL and thus gcc's libstdc++ have 
> > | a _wrong_  void  return type  for:
> > | 
> > |   void  std::map<T>::erase(map<T>::iterator pos);
> > |   void  std::map<T>::erase(map<T>::iterator first, map<T>::iterator last);
> > | 
> > | where they should return an iterator to past what was erased:
> > | 
> > |   map<T>::iterator  std::map<T>::erase(map<T>::iterator pos);
> > |   map<T>::iterator  std::map<T>::erase(map<T>::iterator first, 
> > | 				       map<T>::iterator last);
> > | Please clarify and/or fix.
> > 
> > Where did you get your info?  My copy of 14882 says this about map<>.
> 
> 1.  In ISO/IEC 14882:1998(E)
>     23.1.1 Sequences, page 463 (pdf version)

std::map<> is an Associative container, *not* a Sequence.
  Associative containers are covered in 23.1.2; see table 69 (page 492 in 
  the pdf version) which agrees with 23.3.1.2 .

> 
>     7 The iterator returned from a.erase(q) points to the element
>       immediately following q prior to the ele­ment being
>       erased. If no such element exists, a.end() is returned.
>       
>     8 The iterator returned by a.erase(q1,q2) points to the
>       element pointed to by q2 prior to any elements being
>       erased. If no such element exists, a.end() is returned.
> 
> 2.  http://www.dinkumware.com/htm_cpl/map.html#map::erase

I would call that a bug in their documentation; if P.J. Plauger genuinely
  belived that map<>::erase() should return an iterator, I think he would 
  have submitted an issue to the library working group.

> 
> 
> > 
> > 23.3.1.2 element access:
> > 
> >   void      erase(iterator position);
> >   size_type erase(const key_type& x);
> >   void      erase(iterator first, iterator last);
> > 
[snip]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]