当我尝试在c ++上进行列表迭代调试时遇到问题.
我做了一个简单的测试应用:
int main(int argc, const char * argv[])
{
// insert code here...
std::cout << "Hello, World!\n";
std::list<int> list;
list.push_back(1);
list.push_back(2);
--> list.push_back(3); //Line before step over
for (std::list<int>::const_iterator i = list.begin(); i != list.end(); i++)
{
std::cout << *i << std::endl;
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在调试时,当我在标有箭头的行上时,当我跳过时,它开始踩踏来自c ++文件的代码:'list'.我必须跨越15次,直到它最终到达for语句中的代码.
此问题仅发生在Xcode 4.4中.在Xcode 4.3中,调试工作得很好.
这里有一些不同的场景,结果不同:
在我正在开发的项目中,我们正在使用Apple LLVM编译器4.0和libc ++(支持C++ 11的LLVM C++标准库),所以我需要为场景3解决这个问题.
有谁知道会发生什么,以及是否有解决方法?