title: std::erase_if delete an extra elements on std::vector?
body: <p>I use <code>std::erase_if</code> to erase half the elements from containers using a captured counter as follows. C++20 compiled with <code>gcc10</code></p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;map&gt;
  #include &lt;unordered_map&gt;
  
  int main()
  {
      {
          std::vector&lt;int&gt; container(10);
          std::cout &lt;&lt; container.size() &lt;&lt; std::endl;
          std::erase_if(container, [i = 0u](auto&amp;&amp;...) mutable { return i++ % 2 == 0; });
          std::cout &lt;&lt; container.size() &lt;&lt; std::endl;
      }
      std::cout &lt;&lt; std::endl;
      {
          std::map&lt;int, int&gt; container;
          for (int i = 0; i &lt; 10; i++) {
              container.emplace(i, i);
          }
          std::cout &lt;&lt; container.size() &lt;&lt; std::endl;
          std::erase_if(container, [i = 0u](auto&amp;&amp;...) mutable { return i++ % 2 == 0; });
          std::cout &lt;&lt; container.size() &lt;&lt; std::endl;
      }
      std::cout &lt;&lt; std::endl;
      {
          std::unordered_map&lt;int, int&gt; container;
          for (int i = 0; i &lt; 10; i++) {
              container.emplace(i, i);
          }
          std::cout &lt;&lt; container.size() &lt;&lt; std::endl;
          std::erase_if(container, [i = 0u](auto&amp;&amp;...) mutable { return i++ % 2 == 0; });
          std::cout &lt;&lt; container.size() &lt;&lt; std::endl;
      }
  }
  </code></pre>
  <p>The output is unexpected. For vector, an extra element is removed:</p>
  <pre><code>10
  4
  
  10
  5
  
  10
  5
  </code></pre>
  <p>I print out the result and it seems like <code>vector[1]</code> is the unexpectedly removed element</p>
  <p>Granted that this is not usually a normal usage for erase_if but I'm still curious why it happens only for vector but not for the other map. I'd guess it has something to do with the iterator type shenanigan. Appreciate if someone could give a detailed explanation.</p>