http://www.cplusplus.com/reference/map/map/
我一开始也以为要失效
去查了下,楼主可以记住这个网站
结论是
insert
No changes.
erase
Iterators, pointers and references referring to elements removed by the function are invalidated.
All other iterators, pointers and references keep their validity.
swap
All iterators, pointers and references referring to elements in both containers remain valid, but now are referring to elements in the other container, and iterate in it.
Note that the end iterators do not refer to elements and may be invalidated.