Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2004-08-31 04:45:50


Pavol Droba ha escrito:

> Hi,
>
> I have encountered a problem with vc8.0 std library. I was able to fix
> it, but I'm not sure what is correct according to standard.
>
> The problem can be narrowed to one simple case. In vc8.0 method
>
> iterator std::list<>::erase(iterator First, iterator Last)
>
> returns a 'singular' iterator when the list is empty after erase operation.
> Because I'm dependant on the returned iterator to make insertion
> at this point later on, I had to make an explicit workaroud.
>
> I would expect it to return .end() iterator in this case.
>
> Is this behavior correct according to standard or not?
> If not, is it reasonable to submit bug report?

The std says in lib.sequence.reqmts (23.1.1.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."

So, it seems to me like a bug in VC8.0 stdlib.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk