Hi, all,
I'm a fresh hand to boost. I encounter some problems with ptr_map, in
boost/ptr_container/detail/associative_ptr_container.hpp, line 107 & 111.
size_type erase( const key_type& x ) // nothrow
{
BOOST_ASSERT( !this->empty() );
iterator i = find( x ); // nothrow // line 107
if( i == this->end() ) // nothrow
return 0; // nothrow
this->remove( i ); // nothrow
return this->c_private().erase( i.base() ); // nothrow // line 111
}
In fact I doubt the correctness of these two lines. First, find() is
defined in ptr_map_adapter class, which is a descendant of
associative_ptr_container. No other find() functions could match the
case here. As for the erase() in line 111, it's actually
std::map::erase(). But this overload should return nothing as specified
in C++ standard (in the case of MS implementation, it returns an
iterator). In no way can it be converted to size_type. Simple
modifications on the code could solve this problem.
Another thing for ptr_map_adapter is one of its Insert() overloads
std::pair