
----- Mensaje original ----- De: Thorsten Ottosen <thorsten.ottosen@dezide.com> Fecha: Miércoles, Enero 3, 2007 12:38 pm Asunto: Re: [boost] Weird behaviour/bug in ptr_map Para: boost@lists.boost.org
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