so ... i'm kinda new to these STL ...
i wanna make a list of lists ...
after spending some time to teach myself how to make a list of char I went one step further with a project I have to accomplish ...
so the thing is that i need a list (the list)in which each element will be a list of char(the sublist) .
I am thinking that by using this, each node of the list will have the root of it's sublist ( is that right ? )
And another thing ... how can i add more info to each node of the list(not the sublist), an char or int ... doesnt quite mather ... just the fact that to have more than a sublist in each node.
Is that possible ?
I tried something like this using only int-s . And i came across the problem of accesing the nodes of the list ... such as :

list<int> mylist;
list< list<int> > lista;
// adding elements to mylist ... 
lista.push_back(mylist);
//this works(to my amazement)

How can i step through "lista" (in case i put another list in there besides "mylist") and through mylist(which is now in "lista") so that i can access the elements i added ????
Thanks

you can use an iterator

list<int>::iterator it;
for(it = mylist.begin(); it != mylist.end(); it++)
{
    list<int>& sublist = *it;
    // blabla
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.