ITeye博客

关于std map的插入和删除

calmhawk · 2013-01-17 11:41 · C/CPP Dev · 编程语言 · Markdown

关于代码里map的删除,有一点困惑:

在删除前用iterator保存位置,对map进行插入或删除后,iterator是否有效.

看完标准后释然,直接上标准:
23.1.2.8:The insert members shall not affect the validity of iterators and references to the container, and the erase members shall invalidate only iterators and references to the erased elements.

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。