The problem is that remove_if doesn't have access to the container so it can't remove elements from it. Instead it just keeps the elements that should be removed at the end and returns the position where that is so that you can remove them yourself.
There has been a proposal to add erase_if which just takes a container and a predicate as argument and automatically removes the elements. Unfortunately it hasn't been accepted yet, but we will probably have something like this in the standard library in a few years time.