I have a boost::ptr_vector containing pointers to class "holdable".
boost::ptr_vector<holdable> items;
I add new items to this vector from within the holdable class like this:
currentplanet->items.push_back(this);
where currentplanet is a pointer to an object of the class containing the ptr_vector. This is all fine.
What I'm confused about is how to remove an entry from the ptr_vector from a function within its own class. I'm trying:
currentplanet->items.erase(std::find(currentplanet->items.begin(),
currentplanet->items.end(),
this));
as in accordance with the answer to a similar question here: How to erase elements from boost::ptr_vector, but i've obviously gone wrong somewhere, probably with regard to the use of "this".
On trying to compile, i receive an error from stl_algo.h saying
stl_algo.h|174|error: no match for 'operator==' in '__first.boost::void_ptr_iterator<VoidIter, T>::operator*
[with VoidIter = __gnu_cxx::__normal_iterator<void**, std::vector<void*, std::allocator<void*> > >,
T = holdable]() == __val'|
I'm sure it's something obvious, but i'm probably getting confused by ptr_vector's indirection... thanks for any answers in advance!