I have a Map over which I iterate like this:
std::map<unsigned int, GameObject *>::iterator itr = _gameObjects.begin();
while (itr != _gameObjects.end())
{
itr->second->Update();
itr++;
}
Update() might insert an element into the map or even remove one from it, but it doesn't necessarily do any of the two. It obviously doesn't work like that. Is there a way it can be done?
Update()
insert in to? What behaviour do you want if a new element gets inserted to before the current position of the iterator? – Mankarse May 22 '12 at 16:56Update()
remove itself? – hmjd May 22 '12 at 16:56