|
Boost : |
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2007-01-02 12:44:02
Thorsten Ottosen wrote:
> 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!
>
I could not see that assertion in the 1.34 RC branch? Are your examples
from 1.33?
Here's the definition from 1.34:
size_type erase( const key_type& x ) // nothrow
{
iterator i( this->c_private().find( x ) ); // nothrow
if( i == this->end() ) // nothrow
return 0u; // nothrow
this->remove( i ); // nothrow
return this->c_private().erase( x ); // nothrow
}
This works fine if the map is empty.
Wheter the overload that takes an iterator should be allowed to accept
the end iterator is another issue. I'll give it some thought.
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk