@cexer
http://www.cplusplus.com/reference/stl/vector/erase/这里是一个比较好的描述
“Because vectors keep an array format, erasing on positions other than the vector end also moves all the elements after the segment erased to their new positions”
“This invalidates all iterator and references to elements after position or first.”
删除对象后会让迭代器之后的对象移动,因此而导致迭代器失效
map的实现,红黑树,在插入和删除对象后因为要做平衡,所以同样也有可能导致迭代器的失效
当然最终是不是会出现迭代器错误,这依赖于标准库的具体实现,另外还可能包括其优化方法