在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