报错信息:std::_Rb_tree_increment(std::_Rb_tree_node_base*)
发现该程序cpu占用达到100%, 用这个命令查看消耗cpu很高的函数:perf top -p 进程号 查看死循环函数
补充:顺便提一下,根据实验来看,map编译是先序遍历,不是网上人们说的中序遍历。测试代码如下:
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main()
{
map<string, string> mm;
mm["c"] = "a";
mm["a"] = "a";
mm["b"] = "a";
mm["e"] = "a";
mm["f"] = "a";
mm["d"] = "a";
for (map<string, string>::iterator ite = mm.begin(); ite != mm.end(); ++ite)
{
cout << ite->first << endl;
}
return 0;
}
输出结果:
a
b
c
d
e
f