|
Boost : |
From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2007-01-03 07:20:17
----- Mensaje original -----
De: Thorsten Ottosen <thorsten.ottosen_at_[hidden]>
Fecha: Miércoles, Enero 3, 2007 12:38 pm
Asunto: Re: [boost] Weird behaviour/bug in ptr_map
Para: boost_at_[hidden]
> JOAQUIN LOPEZ MU?Z wrote:
> > My humble opinion is that you shouldn't allow an an end iterator
> > to be legally passed to erase(iterator), that is, your current
> >
> > BOOST_ASSERT( before != this->end() );
> >
> > is conformig. The rational is that erase(end()) is illegal, or
> > at least undefined behavior, in STL containers.
>
> Is it? I couldn't easily deduce that from the standard.
If you go to 23.1.2/7 where a table is given with requirements
for associative containers, the expression "a.erase(q)" involves
the iterator q, which is previously defined to represent a
valid *dereferenceable* iterator to a --and end() is not
dereferenceable. Analogous conditions are present for sequence
containers.
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