您的位置:首页 > 其它

terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check

2014-01-08 20:44 627 查看
编译时没有报错,运行时报错:

terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check

内存读取越界。

解释1:for example:

const std::string sTest( "test" );

sTest.substr( 0, 10 );

will raise the same exception, since you ask 10 characters, but only 5 ( sTest.length()) ) are available.

调试过,正常运行,无报错。

解释2:

Chances are you did something like:

std::string s("foo");

s.substr(5,1); //the length of the string is 3, 5 is out of bounds

调试过,确实会报错,out_of_range
转自:http://blog.csdn.net/wangxmin2005/article/details/7754277
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐