dimanche 6 décembre 2015

std::list remove element by index

I have a std::list full of objects. Whenever I add a object, I want to store that objects index in the list, so later on I can remove it from the list.

What I want to do in pseudo code

myList.pushBack(element);
int index = myList.getIndexOfLastElement();

myList.erase(index);

For performance reasons I can't search by value.

Aucun commentaire:

Enregistrer un commentaire