簡體   English   中英

為什么 STL 在 find() 和 empty() 上“設置”核心轉儲?

[英]Why does STL `set` core dump on find() & empty()?

當我想達到 STL lib set::find 或 empty()... 我得到了核心文件。

我正在使用 gcc 版本 4.1.2 20070115(預發布)(SUSE Linux),請參閱堆棧流程:

#0  0x00002aaaae7caf2a in _STL::_Rb_tree<unsigned int, unsigned int,
_STL::_Identity<unsigned int>, _STL::less<unsigned int>,
_STL::allocator<unsigned int> >::empty (this=0x8)
    at /home/irish/nagrun/add-ons/include/stlport/stl/_tree.h:370
#1  0x00002aaaae7caf4f in _STL::set<unsigned int, _STL::less<unsigned int>, _STL::allocator<unsigned int> >::empty (this=0x8)
    at /home/irish/nagrun/add-ons/include/stlport/stl/_set.h:129
#2  0x00002aaaae7ca5d1 in User::deleteSessionID (this=0x0, sessionID=4143972353)
    at /home/irish/nagrun/NIG_SRC/PresenceEx_V100R001C41B010/Extends/UserManager/User.cpp:60

這怎么可能? 我可以插入集合並使用迭代器在其中遍歷。

您在評論中是正確的:我一直在通過 null 指針調用User上的函數。

我沒有意識到這一點,因為堆棧跟蹤從標准庫函數的深處開始,讓我相信問題出在find上,而不是我調用它的方式上。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM