I’m trying to remove a class object from list<boost::any> l
l.remove(class_type);
I tried writing something like this as a member function
bool operator == (const class_type &a) const //not sure about the arguments
{
//return bool value
}
How would you write an overload function to remove an object of class from a std::list of boost::any?
While your signature for
operator==looks fine, overloading it forclass_typeisn’t enough asboost::anydoesn’t magically use it. For removing elements however you can pass a predicate toremove_if, e.g.: