can you deleting multple elements in vector in one iteration?

Is there a way to delete multiple elements by searching if the return value of a member function equals true.

1
2
  std::vector<std::unique_ptr<Entity>> enteties;
  bool isAlive() const { return alive; }
The erase-remove idiom:
1
2
std::entities.erase(std::remove_if(entities.begin(), entities.end(), 
           [](auto elt){ return elt->isAlive(); }), entities.end());
Last edited on
1
2
entities.erase(std::remove_if(entities.begin(), entities.end(),
					[](auto elt) { return elt->isAlive(); }), entities.end());

i get compile errors.
i get compile errors
no way for anyone to know unless you state what these errors might be. anyways, here's ...
http://coliru.stacked-crooked.com/a/6635eac9c2318874
Topic archived. No new replies allowed.