How would i delete an item from a list<> class while im iterating through the list? I need it to first delete the item, than go to the next item without any problems.
Code:for(list<ThrowObject>::iterator it = throwObjects.begin(); it != throwObjects.end(); ++it)
{
ThrowObject& throwObject = *it;
//do stuff
if(****) //delete the item
{
??
}
}