List library

Hello! I'm trying to make a list that contains other lists. I want to use the <list> library /not my own implementation/.
Here is what I do:

1
2
3
4
5
list<list<int>> Lists; //I create the main list
list<int> A, B; //Then I create the other lists
//After I fill them with data I add them to the main list
Lists.push_back(A);
Lists.push_back(B);


The problem comes when I try to go through A and B. I make an iterator of the main list:

list<list<int>> Iter = Lists.begin();

Then I need to make an iterator to traverse through A and B. But I can't make it. I do this:

list<int> Iter2 = Iter.begin() //But the compiler says it is not possible

How can I traverse through A and B?
1
2
3
std::list<std::list<int> >::iterator i = lists.begin();
//Note the different operator!
std::list<int>::iterator j = i->begin();
Thank you very uch. It works now :)
by the way, I am not familiar, with std::list, but, I really do like std::vector, if, yiou, ever, want to take a look at it.

Cheers

C
Topic archived. No new replies allowed.