c++ stl what does base() do
I have such code : vector <int> v; for (int i=0; i<5; i++) v.push_back(i); v.erase(find(v.rbegin(), v.rend(),2).base()); This code deletes the first element from vector v after first detected 2 (in vector remain: 0 1 2 4). What does .base() do here? base() converts a reverse iterator into the corresponding forward iterator. However, despite its simplicity, this correspondence is not as trivial as one might thing. When a reverse iterator points at one element, it dereferences the previous one, so the element it physically points to and the element it logically points to are different. In the