title: iterator - no matching erase function in c++11
body: <p>I can't exmplain this behaviour:</p>
  <pre><code>for (vector&lt;File&gt;::const_iterator it = this-&gt;files.begin(); it != this-&gt;files.end(); ++it) {
      if (...) erase(it); // break after, no need of ++it in else branch
  }
  </code></pre>
  <p>where File is my own class (std not included) and this-&gt;files is vector of Files</p>
  <p>when I compile the code I get (see <strong>line 2</strong>)</p>
  <pre><code>Path.cpp: In member function ‘void Path::rmFile(File&amp;)’:
  Path.cpp:190:24: error: no matching function for call to ‘std::vector&lt;File&gt;::erase(std::vector&lt;File&gt;::const_iterator&amp;)’
  Path.cpp:190:24: note: candidates are:
  In file included from /usr/include/c++/4.7/vector:70:0,
               from Path.h:5,
               from Path.cpp:1:
  /usr/include/c++/4.7/bits/vector.tcc:135: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 = File; _Alloc =     std::allocator&lt;File&gt;; std::vector&lt;_Tp, _Alloc&gt;::iterator = __gnu_cxx::__normal_iterator&lt;File*,     std::vector&lt;File&gt; &gt;; typename std::_Vector_base&lt;_Tp, _Alloc&gt;::pointer = File*]
  /usr/include/c++/4.7/bits/vector.tcc:135:5: note:   no known conversion for argument 1     from ‘std::vector&lt;File&gt;::const_iterator {aka __gnu_cxx::__normal_iterator&lt;const File*,     std::vector&lt;File&gt; &gt;}’ to ‘std::vector&lt;File&gt;::iterator {aka __gnu_cxx::__normal_iterator&lt;File*,     std::vector&lt;File&gt; &gt;}’
  /usr/include/c++/4.7/bits/vector.tcc:147: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 = File; _Alloc = std::allocator&lt;File&gt;; std::vector&lt;_Tp,     _Alloc&gt;::iterator = __gnu_cxx::__normal_iterator&lt;File*, std::vector&lt;File&gt; &gt;; typename     std::_Vector_base&lt;_Tp, _Alloc&gt;::pointer = File*]
  /usr/include/c++/4.7/bits/vector.tcc:147:5: note:   candidate expects 2 arguments, 1 provided
  make: *** [Path.o] Error 1
  </code></pre>
  <p>even the <a href="http://www.cplusplus.com/reference/vector/vector/erase/" rel="nofollow noreferrer">doc</a>  says it's ok, but error <strong>no matching function for call to std::vector::erase(std::vector::const_iterator&amp;)</strong> is really wierd.</p>
  <p>I really need to be able to delete vector item by iterator. Can anybody help me please?
  Thaks in advance.</p>