Блог пользователя Mr.King.

Автор Mr.King., история, 6 лет назад, По-английски

Hi codeforces! I was deleting the element from ordered map but when i delete the last element from map then i got the RE! why? :(

code
  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

iterators don't work that way

if you erase like in the code, then it will be invalidated, or you can say it "doesn't work" anymore

you can just call a.erase(a.begin()) twice