c 2b 2b erase 28remove if 29

Solutions on MaxInterview for c 2b 2b erase 28remove if 29 by the best coders in the world

showing results for - "c 2b 2b erase 28remove if 29"
Luciana
17 May 2020
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());