Problème avec std::map::iterator après l'appel à effacer()

//erasing from map
#include <iostream>
#include <map>
using namespace std;

int main ()
{
  map<char,int> mymap;
  map<char,int>::iterator it(mymap.begin());

  //insert some values:
  mymap['a']=10;
  mymap['b']=20;
  mymap['c']=30;
  mymap['d']=40;
  mymap['e']=50;
  mymap['f']=60;

  it=mymap.find('a');
  mymap.erase (it);                   //erasing by iterator

  //show content:
  for (; it != mymap.end(); it++ )
    cout << (*it).first << " => " << (*it).second << endl;
  return 0;
}

Pourquoi est-ce que donnera une sortie comme

a => 10
b => 20
c => 30
d => 40
e => 50
f => 60

ne devrait pas "a => 10" être supprimé de toute façon, mais si je déclare it = mymap.begin() dans la boucle for, tout est parfait. pourquoi?

programme adapté de : http://www.cplusplus.com/reference/stl/map/erase/

OriginalL'auteur Sunny Raj | 2011-01-08