STL: How can I delete a <list>...
-
Hi !, I´m new using this STL, now I can add members to a list an iterate though that list, but ... still don´t now how to delete members from it, and free the list in a right way... Can anybody help me ? Thanks a lot,Bye ! Braulio X|
-
Hi !, I´m new using this STL, now I can add members to a list an iterate though that list, but ... still don´t now how to delete members from it, and free the list in a right way... Can anybody help me ? Thanks a lot,Bye ! Braulio X|
****From answer in C++ section**** To clear the whole list: list.erase( list.begin(), list.end() ); To delete a single item: // iter is the iterator of the item you want to delete // iter = list.begin(); // 1st item in list // iter = &(list.at(iIndex)); //iItem in lsi list.erase( iter ); Hope this helps Mike