help with STL container remove_if on a class
I've been looking around for how to use the remove_if function on a list of a class. The examples i'm found haven't helped me much. How do you write a predicate, and what's the syntax for using it?
Code:
class MyClass
{
public:
void SetNum(int);
void SetChar(char);
private:
int num;
char ch;
};
int main()
{
std::list<MyClass> ClassList;
//populate list
ClassList.remove_if/*?*/;
return 0;
}
How could I remove all elements of the list that contained 5 as num?
How could I remove all elements of the list that contain 3 as num and 'a' as ch?