I created a program, and it uses the vector.h #include, and iterators, etc... But when I run the program, under certain circumstances (I'm still trying to figure out what those would be) I get an assertion error refering me to line 98 of vector.h. I went to line 98 of vector.h and got this:
#if _HAS_ITERATOR_DEBUGGING
if (this->_Mycont == 0
|| _Myptr < ((_Myvec *)this->_Mycont)->_Myfirst
|| ((_Myvec *)this->_Mycont)->_Mylast <= _Myptr)
{
_DEBUG_ERROR("vector iterator not dereferencable");
_SCL_SECURE_OUT_OF_RANGE;
}
Can somebody please tell me what this means and what in my program is causing this assertion?
NB: Line 98, for the record, is the one that begins "_DEBUG_ERROR("vect..."
NB: This is the code in my program that I BELIEVE triggered the error, I'm not entirely sure, though.
CODE:
for(aI = antiviral_data.begin(); aI < antiviral_data.end();)
{
for(vI = viral_data.begin(); vI < viral_data.end();)
{
if((*aI)->x == (*vI)->x && (*aI)->y == (*vI)->y)
{
vI = viral_data.erase(vI);
aI = antiviral_data.erase(aI);
}
else
{
vI++;
}
}
if((*aI)->x >= maxx || (*aI)->x < 0 || (*aI)->y >= maxy || (*aI)->y < 0)
{
aI = antiviral_data.erase(aI);
}
else
{
aI++;
}
}