Iterator Question?


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]

Posted by David Shell on April 22, 2001 at 17:24:03:

I am getting an Access Violation...
My Ecosystem is looping through the lists and telling all the Creatures in the lists to tick, and one of them dies, and then then next time around the loop, it crashes. It is deleting the creature just fine, and supposedly removing it from the list, but the next time around, it hits a creature that is already Dead, and this makes it crash. I am not sure if this is a problem with my iterator or not. The notes say that inserting/deleting from an stl list does not invalidate the iterators, so I was just continuing on by incrementing the iterator, and going back to the top of the loop again. Is this wrong? Anyone have any suggestions?


Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]