Re: Erase in a map
- From: Ulrich Eckhardt <eckhardt@xxxxxxxxxxxxxx>
- Date: Mon, 16 Apr 2007 13:20:45 +0200
Norbert Unterberg wrote:
Ulrich Eckhardt schrieb:
The typically used solution is this:
while(it!=end)
if(predicate(*it))
container.erase(it++);
erase() returns an iterator of the element after the erased ones.
According to my pre-release copy of the standard, that is a requirement for
containers that model the sequence requirement. However, that same copy
mandates a void returntype for erase(iterator) of [multi](set|map), and
that is effectively what is done by several implementations of the
standardlibrary. I believe that the Dinkumware library returns iterators as
an extension or for backward compatibility with the STL.
Uli
.
- Follow-Ups:
- Re: Erase in a map
- From: Tom Widmer [VC++ MVP]
- Re: Erase in a map
- References:
- Re: Erase in a map
- From: Norbert Unterberg
- Re: Erase in a map
- Prev by Date: Re: Erase in a map
- Next by Date: strange crash after assertion with std::map::iterator
- Previous by thread: Re: Erase in a map
- Next by thread: Re: Erase in a map
- Index(es):
Relevant Pages
|