我收到以下调试错误:
Debug Assertion Failed!
Program: Path\To\vc\include\xtree
Line: 237
Expression: map/set iterator not dereferencable
这些代码行:
for(std::map<int,IO::ctcolor>::iterator it = IO::colorTable.begin(); it != IO::colorTable.end();) {
//left out some code here, but even without it doesn't work
cout << "dummy"; //gets printed multiple times while iterating, so the map is not empty
++it;
}
for 循环遍历所有元素,IO::colorTable
但在到达末尾时不会停止,我可以在循环内将数据打印到控制台时看到这一点。
编辑:我刚刚注意到错误发生在我错误地尝试访问的 for 循环之后的行中it