A: 

I don't know. Maybe there is. But if there is, then it will be a hell of a statement. Nobody will be able to understand or maintain it. If those two lines do what you want, just stick with them. They are perfectly good.

Ralph
jaff's suggestion is idiomatic. And professional C++ programmer should understand it instantly.
John Dibling
+5  A: 

You mean like this?

vec.erase( std::remove_if( vec.begin(), vec.end(), pred ), vec.end() );

That's the idiomatic way to do it.

jalf
This is still an algorithm plus a member function call, not a single algorithm call. I would not regard this as improvement over the original suggestion.
Ralph
True. The thread title asks for a single *statement* though, and this version lives up to that requirement. But yeah, there's no built-in single function that has the desired effect, but it's easy to compose yourself, like ckarmann's answer shows.
jalf
+5  A: 

The idiomatic way to do it is like jalf has said. You can build your own function to do that more easily:

template<typename T, typename Pred> void erase_if(T &vec, Pred pred)
{
    vec.erase(std::remove_if(vec.begin(), vec.end(), pred), vec.end());
}

So you can use

std::vector<int> myVec;
// (...) fill the vector. (...)
erase_if(myVec, myPred);
ckarmann
Very neat. Obvious when you see it but wouldn't have thought of it myself. I think I might stick with Jalf's method as you can see what is being used but I'm probably just being a wimp...
Patrick