c 2b 2b remove multiple items from list

Solutions on MaxInterview for c 2b 2b remove multiple items from list by the best coders in the world

showing results for - "c 2b 2b remove multiple items from list"
Ricardo
26 Feb 2018
1class Anything{
2public:	int func() };
3
4list<Anything> lst = <some_elements>;
5
6//removes every element in list that returned true in line 9
7lst.erase(std::remove_if(lst.begin(), lst.end(),
8                       [&](const Anything lst)-> bool
9                       { return lst.func() == something; }), //any condition
10        lst.end());