How to change the value of the returned predicate and remove elements that return false instead of true?
Here is my code:
headerList.remove_if(FindName(name));
(please ignore the lack of erasure)
with FindName a simple functor:
struct FindName { CString m_NameToFind; FindInspectionNames(const CString &nameToFind) { m_NameToFind = nameToFind; } bool operator()(const CHeader &header) { if(header.Name == m_NameToFind) { return true; } return false; } };
I would like something like:
list.remove_if(FindName(name) == false);
C ++ 0x is not used yet, so lambdas is not allowed, unfortunately. I hope there is a nicer solution than writing the NotFindName functor.
c ++ stl predicates remove-if
Dandan
source share