remove-if

Turning remove_if into remove_not_if

How can I reverse a predicate's return value, and remove the elements that return false instead of true? Here is my code: headerList.remove_if(FindName(name)); (please ignore lack of erase) with FindName a simple functor: struct FindName { CString m_NameToFind; FindInspectionNames(const CString &nameToFind) { m...

In C++, removing an object from a list

I'm writing a program which is more or less like this : #include <list> list<MyClass> things; class MyClass { // some stuff void remove() { things.remove_if(THING_IS_ME); } }; What do I need to write instead of THING_IS_ME? In other words, I'm using a global STL list as a collection of things. At some point, an obj...