#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. windows命令启动mysql

    找到mysql的安装位置,进入bin目录 dos输入  mysql -h localhost -uroot -p   ,在输入密码

  2. 转:x64与x86的改变

    http://tieba.baidu.com/p/1250470248 x64与x86的改变 硬件要求就是64位的CPU.操作系统也必须是64位的,如果在64位的CPU上安装了32位的操作系统,就算编 ...

  3. Crontab 在linux中的非常有用的Schedule Jobs

    crontab 是linux系统集成的定时任务命令,它对于系统运行(数据的备份,调度系统资源或命令,程序的定时触发等非常有用).crontab有些类似于Windows系统的Service的任务计划程序 ...

  4. Codeforces Round #423 A Restaurant Tables(模拟)

    A. Restaurant Tables time limit per test 1 second memory limit per test 256 megabytes input standard ...

  5. Oracle关于锁的几种类型和参数

    设立封锁机制主要是为了对并发操作进行控制,对干扰进行封锁,保证数据的一致性和准确性.Oracle数据库封锁方式有三种:共享封锁,独占封锁,共享更新封锁 封锁类型 Oracle RDBMS的封锁类型可分 ...

  6. BZOJ 3632 外太空旅行(最大团)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=3632 [题目大意] 求图中的最大团. [题解] 最大团问题是npc问题,因此可以考虑随 ...

  7. k-近邻算法 简单例子

    from numpy import * import operator def create_data_set(): # 训练集与标签 group = array([[1.0, 1.1], [1.0, ...

  8. UVA 12284 Digital Matrix

    思路:这个分清楚情况就很好做了. 注意一点当A的转置等于B的时候(对角线除外),记录A的下三角(或上三角)有cnt个的数与B不同,如果cnt>1则 不需要额外的步数就可以了,否则当k==2时结果 ...

  9. Problem K: 零起点学算法107——统计元音

    #include<stdio.h> int main() { int n; ]; while(scanf("%d%*c",&n)!=EOF) { while(n ...

  10. Codeforces Beta Round #2 C. Commentator problem 模拟退火

    C. Commentator problem 题目连接: http://www.codeforces.com/contest/2/problem/C Description The Olympic G ...