erase-remove-idiom

Erase-remove idiom: what happens when remove return past-the-end-iterator?

I got this question when I was reading erase-remove idiom (item 32) from Scott Meyers "Effective STL” book. vector<int> v; ... v.erase(remove(v.begin(), v.end(), 99), v.end()); remove basically returns the "new logical end” and elements of the original range that start at the "new logical end" of the range and continue until the real...

boost bind compilation error

class A { bool OutofRange(string& a, string& b, string c); void Get(vector <string>& str, string& a, string& b); } void A::Get(vector <string>& str, string& a, string& b) { str.erase( std::remove_if (str.begin(), str.end(), BOOST_BIND(&A::OutOfRange, a, b, _1)), str.end() ); } I am getting ...