Which standard library algorithm removes elements matching a predicate from a container?
- A std::remove_if alone
- B std::remove_if followed by container.erase
- C std::delete_if
- D container.remove_all
Answer
std::remove_if followed by container.erase
remove_if only shifts elements and returns a new logical end. The erase-remove idiom is needed to actually shrink the container.





