在VS2005 SP1的Debug配置中编译的以下代码显示两条带有“ITERATOR LIST CORRUPTED”通知的消息。ITERATOR LIST在std :: string构造函数中损坏
代码段
#define _SECURE_SCL 0
#define _HAS_ITERATOR_DEBUGGING 0
#include <sstream>
#include <string>
int main()
{
std::stringstream stream;
stream << "123" << std::endl;
std::string str = stream.str();
std::string::const_iterator itFirst = str.begin();
int position = str.find('2');
std::string::const_iterator itSecond = itFirst + position;
std::string tempStr(itFirst,itSecond); ///< errors are here
return 0;
}
它是在编译器或标准库中的错误?
VS2008也适用于我。迷人。 – avakar 2010-03-10 10:10:51
考虑使用codepad.org快速测试gcc:http://codepad.org/mXXYxf99这绝对是一个Windows/Visual Studio错误。请报告。 – 2010-03-11 02:40:29