title: Missing const_iterator overload of std::vector::erase() with g++ 4.8
body: <p>The <a href="http://ideone.com/98uLBy" rel="noreferrer">following example</a> will not compile using g++ 4.8.2:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  int main() {
      vector&lt;int&gt; v {1, 2, 3};
  
      v.erase(v.cbegin()); // Compiler complains
  
      return 0;
  }
  </code></pre>
  
  <p>The compiler says the following.  (It isn't very readable, but it's complaining that there's not a known conversion between <code>vector&lt;int&gt;::const_iterator</code> and <code>vector&lt;int&gt;::iterator</code>.)</p>
  
  <pre><code>prog.cpp: In function ‘int main()’:
  prog.cpp:8:20: error: no matching function for call to ‘std::vector&lt;int&gt;::erase(std::vector&lt;int&gt;::const_iterator)’
    v.erase(v.cbegin());
                      ^
  prog.cpp:8:20: note: candidates are:
  In file included from /usr/include/c++/4.8/vector:69:0,
                   from prog.cpp:2:
  /usr/include/c++/4.8/bits/vector.tcc:134:5: note: std::vector&lt;_Tp, _Alloc&gt;::iterator std::vector&lt;_Tp, _Alloc&gt;::erase(std::vector&lt;_Tp, _Alloc&gt;::iterator) [with _Tp = int; _Alloc = std::allocator&lt;int&gt;; std::vector&lt;_Tp, _Alloc&gt;::iterator = __gnu_cxx::__normal_iterator&lt;int*, std::vector&lt;int&gt; &gt;; typename std::_Vector_base&lt;_Tp, _Alloc&gt;::pointer = int*]
       vector&lt;_Tp, _Alloc&gt;::
       ^
  /usr/include/c++/4.8/bits/vector.tcc:134:5: note:   no known conversion for argument 1 from ‘std::vector&lt;int&gt;::const_iterator {aka __gnu_cxx::__normal_iterator&lt;const int*, std::vector&lt;int&gt; &gt;}’ to ‘std::vector&lt;int&gt;::iterator {aka __gnu_cxx::__normal_iterator&lt;int*, std::vector&lt;int&gt; &gt;}’
  /usr/include/c++/4.8/bits/vector.tcc:146:5: note: std::vector&lt;_Tp, _Alloc&gt;::iterator std::vector&lt;_Tp, _Alloc&gt;::erase(std::vector&lt;_Tp, _Alloc&gt;::iterator, std::vector&lt;_Tp, _Alloc&gt;::iterator) [with _Tp = int; _Alloc = std::allocator&lt;int&gt;; std::vector&lt;_Tp, _Alloc&gt;::iterator = __gnu_cxx::__normal_iterator&lt;int*, std::vector&lt;int&gt; &gt;; typename std::_Vector_base&lt;_Tp, _Alloc&gt;::pointer = int*]
       vector&lt;_Tp, _Alloc&gt;::
       ^
  /usr/include/c++/4.8/bits/vector.tcc:146:5: note:   candidate expects 2 arguments, 1 provided
  </code></pre>
  
  <p><strong>Why?</strong>  The C++11 standard plainly states, in §23.3.6.5, that the <code>vector::erase</code> function <strong>takes a <code>const_iterator</code></strong>.  (Paraphrases are <a href="http://en.cppreference.com/w/cpp/container/vector/erase" rel="noreferrer">here</a> and <a href="http://www.cplusplus.com/reference/vector/vector/erase/" rel="noreferrer">here</a>.)</p>
  
  <p>What's a good workaround, assuming that I must use a <code>const_iterator</code>?</p>