So I have this problem with not being able to iterate over a vector in a nestled for-loop. Here's the nestled for-loop (Sorry for the lack of indentation):
What happens is, after having called the collisionDestroy-function and the program tries to execute the nest loop in the outer for-loop, it all crashes with the text "Expression: vector iterator not decrementable", which I understand is because the iterator will have already become useless. The question is: know this, how do I fix it? I can't seem to get a hang of it.
Here's the collisionDestroy-function (the collisionReaction does nothing but sets a few local variables):
void Enemy::collisionDestroy(std::vector<Sprite*>& sprites)
{
for (std::vector<Sprite*>::iterator iter = sprites.begin(); iter != sprites.end(); iter++)
{