
我的问题是插入和删除其他元素是否使获得的迭代器无效?从我做过的简单测试我可以看到它不是,但我想确保这个功能是设计的.
解决方法 它永远不会使迭代器或指针/对元素的引用无效.仅当您删除元素本身时,迭代器或指针/引用才会变为无效.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.
以上是内存溢出为你收集整理的c – std :: set.find()返回的迭代器有多长?全部内容,希望文章能够帮你解决c – std :: set.find()返回的迭代器有多长?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)