modifying lists in a list

Hey,

I have created a list with list in it (in which are stored integers). In each of the 'final' lists are integers stored (1 to 9). Now I am trying to erase/add one of these numbers in a specific list. How can I do this? For example, I want to erase the 4 out of the second list.
thnx!
Post code.
Step 1: Post some code.
Use the erase function
http://www.cplusplus.com/reference/stl/list/erase.html


1
2
3
4
5
6
7
8
int List=1,//second list
   Element=3;//4th element

list<list<int>>::iterator it1 = TheListOfLists.begin();
for (int i=0; i<List; i++,it1++);
list<int>::iterator it2 = it1->begin();
for (int i=0; i<Element; i++,it2++);
it1->erase(it2);
Last edited on
Topic archived. No new replies allowed.