
JOAQUIN LOPEZ MU?Z wrote:
Hello Thorsten, this issue was already raised and corrected on September 2005, you might want to consult the thread at http://tinyurl.com/tpl54 .
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 thought.
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. cheers -Thorsten