The following code does not successfully compile:
boost::ptr_map testmap;
testmap.erase(5);
The compiler (MSVC 7.1) complains that the identifier "find" is unknown
inside the erase function (see below). The class does have a find function
as "testmap.find(5)" compiles as expected. I expect it's a mismatch with the
embedded classes.
Taken directly from associate_ptr_container.hpp:
size_type erase( const key_type& x ) // nothrow
{
BOOST_ASSERT( !this->empty() );
iterator i = find( x ); // ERROR ON THIS LINE
if( i == this->end() )
return 0;
this->remove( i );
return this->c_private().erase( i.base() );
}
The following workaround does work at least, but the above should also,
shouldn't it?
testmap.erase( testmap.find(5) );
-- Bill Buklis --