irr::core::list

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
xiaOK
Posts: 6
Joined: Wed Dec 22, 2010 8:34 pm

irr::core::list

Post by xiaOK »

Hi,
I just cant find the "pop" function in list class.
Anyway to do it? or I should write it myself
Iyad
Posts: 140
Joined: Sat Mar 07, 2009 1:18 am
Location: Montreal, Canada

Post by Iyad »

There is no popback function like in stl::vector or in irrlicht array. To delete the last element of the list, just use the iterator and get the last element, then delete it.

Code: Select all

list<T*>::Iterator i = MyList.end();
delete (*i);
MyList.erase(i);
Delete simply remove the pointed value from the iterator, and the erase function remove the element i from the list.
#include <Iyad.h>
Post Reply