The original code has only one issue:
for(; iter != endIter; *++iter*++iter) { if(Some Condition) { // is it safe ? aMap.erase(*iter++*iter++); } } Here the iteriter is incremented once in the for loop and another time in erase, which will probably end up in some infinite loop.