Đoạn mã dưới đây được biên dịch trong cấu hình Debug trong VS2005 SP1 cho thấy hai thông điệp với thông báo “DANH SÁCH ĐIỀU KHIỂN DANH SÁCH”.DANH SÁCH ITERATOR ĐƯỢC CHỈ ĐỊNH trong std :: string constructor
Code Snippet
#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;
}
Có một lỗi trong trình biên dịch hoặc thư viện tiêu chuẩn?
Xảy ra với tôi trên VS2008. Hấp dẫn. – avakar
Cân nhắc sử dụng codepad.org để thử nghiệm chống lại gcc nhanh chóng: http://codepad.org/mXXYxf99 đây chắc chắn là lỗi cửa sổ/visual studio. hãy báo cáo. –