Page 1 of 1

irr::core::list

Posted: Wed Jan 19, 2011 11:33 pm
by xiaOK
Hi,
I just cant find the "pop" function in list class.
Anyway to do it? or I should write it myself

Posted: Thu Jan 20, 2011 12:55 am
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.