title: 'Cannot Increment end list iterator' Run-time error (Visual C++)
body: <p>Whenever I put in any amount of items in my list and attempt to convert them to an unordered map with an integer inside the list item as the key, I keep getting the error about the end-list iterator when I try to erase every element in the list. My code is below.</p>
  
  <pre><code>for (auto iter = tList.begin(); iter != tList.end(); iter++)
      {
          tMap[(*iter)-&gt;getID()] = move(*iter);
      }
  //Specifically it's this section here with 2 iterators I'm having an issue with
      for (auto iter = tList.begin(); iter != tList.end(); iter++)
      {
          for (auto iter2 = iter; iter2 != tList.end(); iter2++)
          {
              tList.erase(iter, iter2);
              iter2++; 
              //Intentional so iter2 goes up by 2 each time while the first iter goes up by 1
          }
      }
      for (pair&lt;int, Item *&gt; e : tMap)
      {
          cout &lt;&lt; e.first &lt;&lt; " " &lt;&lt; e.second &lt;&lt; endl;
      }
      for (auto iter = t.begin(); iter != tMap.end(); iter++)
      {
          tMap.erase(iter);
      }
  </code></pre>