kkvcb 2016-09-07 04:23 采纳率: 66.7%
浏览 3928

c++ map插入数据,导致段错误

出错时堆栈信息:
#0 0x001a03f0 in std::string::compare () from lib/libstdc++.so.6
#1 0x003c4b56 in std::operator< , std::allocator > (__lhs=@0x91a4228, __rhs=@0x96b1afc4)
at /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:2213
#2 0x003c4b74 in std::lessstd::string::operator() (this=0x91a4218, __x=@0x91a4228, __y=@0x96b1afc4)
at /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h:227
#3 0x017d4e25 in std::_Rb_tree, std::_Select1st >, std::lessstd::string, std::allocator > >::lower_bound (this=0x91a4218, __k=@0x96b1afc4)
at /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:1371
#4 0x017d4ea3 in std::map, std::allocator > >::lower_bound (this=0x91a4218, __x=@0x96b1afc4) at /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_map.h:576
#5 0x017dbbf2 in std::map, std::allocator > >::operator at /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_map.h:345

出错的语句:
pEntity->m_mapID[log.strID]=log;
我对stl不太了解,请问这个错误可能是什么什么原因?

  • 写回答

6条回答

  • hijack00 2016-09-07 04:33
    关注

    感觉你把代码贴出来更容易找到错误。感觉使用STL时编译器给出的出错信息好多并没什么用

    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?