Answers for "c++ erase(remove_if)"

C++
3

c++ erase(remove_if)

class Anything{
public:	int func() };

list<Anything> lst = <some_elements>;

//removes every element in list that returned true in line 9
lst.erase(std::remove_if(lst.begin(), lst.end(),
                       [&](const Anything lst)-> bool
                       { return lst.func() == something; }), //any condition
        lst.end());
Posted by: Guest on March-08-2021

Browse Popular Code Answers by Language