I have a loop
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++;
aI++;
}
}
}
But when ever antiviral_data contains an element, I get the error "vector iterator is not reversible." Why am I getting this error and where do I dereference an invalid iterator?
Note. So far, an error exists only when the if () operator is false. I do not know what will happen if the if () statement is correct.
user98188
source
share