Once you're in remove_if
, you've lost the this
pointer of
A
. So you'll have to declare a functional object which holds
it, something like:
class IsInvalidB
{
A const* myOwner;
public:
IsInvalidB( A const& owner ) : myOwner( owner ) {}
bool operator()( B const& obj )
{
return myOwner->invalidB( obj );
}
}
Just pass an instance of this to remove_if
.