David Bilsby wrote:
Quote:
The code asserts in VC 2005 with an "iterator not
dereferenceable" at:
>
if (this->_Mycont == 0
|| _Ptr == ((_Myt *)this->_Mycont)->_Myhead)
{
_DEBUG_ERROR("list iterator not dereferencable");
_SCL_SECURE_TRAITS_OUT_OF_RANGE;
}
>
_Mycont is 0 when it fails.
That basically means that either you didn't get this iterator from a
container or (maybe) that the container ceased to exist. Note that I'm not
sure with the latter part, it would require that a dying container zeroes
all the back pointers in its iterators and I'm not sure if the debug
variant of VC8's stdlib does that. However, that should be trivial to find
out:
typedef ... container;
container::iterator it;
*it; // should fail, iterator not from container
{
container c(1);
it = c.begin();
*it; // okay, container still alive
}
*it; // should fail, container ceased to exist
Otherwise, can you distill a minimal example from your code?
Uli