Hi ppl,
I am not very good with STL and I am getting an error in trying to delete the contents of an iterator and the iterator itself and then continue without them.
I am not sure how to overcome the error.
Any help would be greatly appreciated as to how this can be overcome.
Code:
RECT rcLastSpPos;
SPRITEACTION saSpriteAction;
list<Sprite*>::iterator SpriteIterator;
for (SpriteIterator = m_lSprites.begin(); SpriteIterator != m_lSprites.end(); SpriteIterator++)
{
rcLastSpPos = (*SpriteIterator)->GetPosition();
// Update the sprite
saSpriteAction = (*SpriteIterator)->Update();
// Handle the SA_KILL sprite action
if (saSpriteAction & SA_KILL)
{
// Destroy the sprite
delete (*SpriteIterator);
m_lSprites.erase(SpriteIterator);
SpriteIterator--;
continue;
}
etc....etc...
}
List iterator not incremental.... Assertion Error
Thanks