Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2007-01-02 06:02:08


Joshua Moore-Oliva wrote:
> I was doing what I do regularly with std::maps... a
> m_plsts.erase( m_plsts.begin(), m_plsts.end() ); on a boost::ptr_map. It
> failed with an assertion error... Digging around, it came from
> ptr_container/detail/associative_ptr_container.hpp on line 117. It appears
> that every single erase (including that done by a key) has an assert for the
> list not being empty!
>
> Why is this the case? As far as I understand, it is valid to attempt to
> remove a key that does not exist. It follows that the same behaviour would
> occur whether the map was empty or not. Attempting to remove an element from
> an empty map should not result in an abort.
>
> If I'm unaware of some C++ convention I would love to be informed, however
> this definitely screams bug to me.

I think you're right.

Thomas, is it ok to fix this in the 1.34 branch?

-Thorsten


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