remove_if help!!

i would like to know how to remove an object from a list base on a condition?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Class A
{
   public:
          A(int x,int y);
          int x;
          int y;
};


int main()
{
     list<A> listA;

A lista1(123,32);
listA.push_back(lista1);
A lista2(3123,1233);
listA.push_back(lista2);
A lista3(123,4123);
listA.push_back(lista3);

//HERE HOW TO REMOVE LIST if x = 123?
listA.erase(remove_if(listA.begin(),listA.end(),/*REMOVE CRITERIA*/);
}
Last edited on
Topic archived. No new replies allowed.