vc2010多线程使用std标准模板库容器DEBUG版迭代器BUG
在vc2010多線程環(huán)境下使用std標準模板庫容器 list 時, 如果是DEBUG版本, 迭代器存在BUG
#if _ITERATOR_DEBUG_LEVEL == 2
?? ?void _Orphan_ptr(_Myt& _Cont, _Nodeptr _Ptr) const
?? ??? ?{?? ?// orphan iterators with specified node pointers
?? ??? ?_Lockit _Lock(_LOCK_DEBUG);
?? ??? ?const_iterator **_Pnext = (const_iterator **)_Cont._Getpfirst();
?? ??? ?if (_Pnext != 0)
?? ??? ??? ?while (*_Pnext != 0)
?? ??? ??? ??? ?if ((*_Pnext)->_Ptr == this->_Myhead
?? ??? ??? ??? ??? ?|| _Ptr != 0 && (*_Pnext)->_Ptr != _Ptr)
?? ??? ??? ??? ??? ?_Pnext = (const_iterator **)(*_Pnext)->_Getpnext();
?? ??? ??? ??? ?else
?? ??? ??? ??? ??? ?{?? ?// orphan the iterator
?? ??? ??? ??? ??? ?(*_Pnext)->_Clrcont();
?? ??? ??? ??? ??? ?*_Pnext = *(const_iterator **)(*_Pnext)->_Getpnext();
?? ??? ??? ??? ??? ?}
?? ??? ?}
?#endif /* _ITERATOR_DEBUG_LEVEL == 2 */
解決辦法,跟蹤_ITERATOR_DEBUG_LEVEL 宏定義,打開yvals.h文件,將157行的
#define _HAS_ITERATOR_DEBUGGING 1 改為 #define _HAS_ITERATOR_DEBUGGING 0
總結(jié)
以上是生活随笔為你收集整理的vc2010多线程使用std标准模板库容器DEBUG版迭代器BUG的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: beyond compare 3.10在
- 下一篇: vc 2010 无法输出中文