Re: VS2005, std::list, _Const_iterator::operator==((const _Myt_iter& _Right) const

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Thomas <ad-tw@xxxxxxxxxxx> wrote:
I crash in the _Const_iterator::operator==(const _Myt_iter& _Right)
const _SCL_SECURE_TRAITS_VALIDATE(this->_Mycont != NULL &&
this->_Mycont == _Right._Mycont);

I use a GTL (graph template library) based on STL, I port the Dll to
VS2005, I can compile it but I crash during runtime.

I switched it off via #define _SECURE_SCL 0 and it works.

Are you using list::swap method by any chance? The new iterator
debugging code has every iterator remember what container it is an
iterator of. Here in comparison operator, the assertion checks that the
two iterators being compared actually come from the same container.

When you call swap() method to swap the internals of the two containers,
iterators on one container start pointing into the other and vice versa.
I've seen reports that the iterator's reference back to its container is
not updated in this case, so the iterator thinks it points into one
container while in reality it points into another.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.



Relevant Pages