#include <list>
using namespace std; int _tmain(int argc, _TCHAR* argv[])
{
list<int> slist;
list<int>::iterator iter;
slist.push_back(1);
slist.push_back(5);
slist.push_back(11);
for(iter = slist.begin(); iter != slist.end(); ++iter)
{
if(11 == *iter)
slist.erase(iter);
}
return 0;
}

问题(vector iterator not incrementable For information on how your program can cause an an assertion Failure, see the Visual c + + documentation on asserts. (Press Retry to debug the application)
这个比较典型,当删除的元素不是最后一个,则没有太大问题。
VS2008下运行这个,当slist.erase(iter);当要删除的元素是slist中的最后一个的时候,执行erase之后
iter就指向end了,再次进入for循环,执行++iter就出错了。。。(erase会是迭代器失效)

默认的是const  iterator  是会出现这种错误的:

判断

if (it != m_Bullsts.end())   //迭代器失效
{
it++;
}

vector iterator not incrementable For information on how your program can cause an an assertion Failure, see the Visual c + + documentation on asserts的更多相关文章

  1. [转]vector iterator not incrementable 的问题

    转自:http://blog.csdn.net/kuaile123/article/details/11105115 vector::erase误使用问题: 暂时使用经验: 不能在循环中使用,否则会报 ...

  2. C++ error C2440: “类型转换” : 无法从“std::vector::iterator”转换为“

    原文地址:http://blog.csdn.net/onlyou930/article/details/5602654 圆环套圆环之迭代器 话说这一日是风平浪静,万里乌云,俺的心情好的没得说,收到命令 ...

  3. 迭代器类vector::iterator 和 vector::reverse_iterator 的实现、迭代器类型、常用的容器成员

    一.迭代器 迭代器是泛型指针 普通指针可以指向内存中的一个地址 迭代器可以指向容器中的一个位置 STL的每一个容器类模版中,都定义了一组对应的迭代器类.使用迭代器,算法函数可以访问容器中指定位置的元素 ...

  4. STL.vector.iterator的序号

    ZC:网上查到,使用vector时,只要将 find到的iterator(itX)减去vector::begin() 就可以得到itX的序号. 1.需求:得到 某个 iterator在 vector中 ...

  5. ERROR: iterator not incrementable || iterator not decrementable

    这个错误提示:迭代器不可以增加 exmaple: vector<int> tVecInt; vector<int>::reverse_iterator iterInt = tV ...

  6. map set iterator not incrementable 解决办法

    例子: #include <iostream> #include <map> using namespace std; int main() { map<int, int ...

  7. cb37a-_c++_STL_算法_复制元素copy_copy_backward

    cb37a-_c++_STL_算法_复制元素copy_copy_backward copy(),同一个容器内部区间的拷贝,或者容器与容器之间的拷贝copy_backward()//向后copy 注意: ...

  8. opencv 3.2 vs2015 debug assertion __acrt_first_block == header

    网上复制了一个转直方图的代码 ,说来也奇怪, 用imshow 显示 图片在独立窗体内,不存在问题, 要注释掉这段代码就出现了下边的错误. 网上查了查,原来是程序中 有个std::vector<c ...

  9. program files (x86)\microsoft visual studio 14.0\vc\include\xtree,如果没有找到,下标溢出了,就报错咯

    ---------------------------Microsoft Visual C++ Runtime Library---------------------------Debug Asse ...

随机推荐

  1. 如何让js在最后执行

    $(window).bind("load", function () { var height = $(document.body).height(); $('.syntaxhig ...

  2. Implement Trie(LintCode)

    Implement Trie Implement a trie with insert, search, and startsWith methods. 样例   注意 You may assume ...

  3. org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current thread

    spring与hibernate整合报错 org.hibernate.HibernateException: Could not obtain transaction-synchronized Ses ...

  4. VB程序打包方法之如何在发布安装之后不带源码

    很久之前,我发表了一片博客是VB程序如何打包,在那里面我总结了两个方法.有兴趣可以看看我的这篇博客http://blog.csdn.net/lu930124/article/details/88467 ...

  5. luogu P1002 过河卒

    题目描述 棋盘上A点有一个过河卒,需要走到目标B点.卒行走的规则:可以向下.或者向右.同时在棋盘上C点有一个对方的马,该马所在的点和所有跳跃一步可达的点称为对方马的控制点.因此称之为“马拦过河卒”. ...

  6. [TCO2013]TrickyInequality

    $\newcommand{stirf}[2]{{{#1}\brack{#2}}}$$\newcommand{stirs}[2]{{{#1}\brace{#2}}}$题意:$\sum\limits_{i ...

  7. Java高级架构师(一)第37节:反向代理和动静分离的实现

    http协议->server->location 输入http:locahost:80/ 进入百度的界面. 做负载转发测试.路径已经转发,可能一些协议已经屏蔽了,导致内容出不来. 关于负载 ...

  8. Codeforces Beta Round #3 A. Shortest path of the king 水题

    A. Shortest path of the king 题目连接: http://www.codeforces.com/contest/3/problem/A Description The kin ...

  9. Integer引用类型问题

    public class TestMain { public static void main(String[] args) { Integer integer = 2; go(2); System. ...

  10. kindeditor在Firefoxt 和 Chrome 下不能取到值的解决方法

    默认form模式提交数据的时候,在ie下用户不需要进行任何设置和调用sync函数,因为editor已经自动调用,但是在firefox和 chrome下,用户如果不手动调用sync函数,editor的数 ...