Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2007-01-03 06:38:18


> Hello Thorsten, this issue was already raised and corrected
> on September 2005, you might want to consult the thread at
> .

Thanks for the hint! :-)

>>Wheter the overload that takes an iterator should be allowed to
>>accept the end iterator is another issue. I'll give it some
> 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.

> The additional check
> BOOST_ASSERT( !this->empty() );
> at the same member function is almost immaterial, since if
> the container is empty then end() is the only valid iterator
> that can be possibly passed in.

Well, it doesn't really hurt, and it might catch error where an iterator
from one container is used with another container.



Boost list run by bdawes at, gregod at, cpdaniel at, john at