How do I get in to list that is in a list!?

1
2
3
4
5
6
7
8
9
10
11
12
13
 srand(time(NULL));
    int rand_cust = 0;
    list<cash_register> l1;
    list<cash_register> ::iterator it;

    int in;

    cash_register b;
    b.add_People(1);
    l1.push_front(b);
    l1.front(); // I getting access to this list but inside this is a list.
                // HOW IN THE HELL TO I GET ACCESS TO THAT one??
    
std::list::front() returns a reference to the first element of the list. You can do
1
2
cash_register& list_front = l1.front();
list_front.DoStuff();

You can also use this syntax
 
l1.front().DoStuff();
Last edited on
l1.front().front();
Thanks for the answer!
I have one more question if want to loop throug the "inner" list how should i do that then?
Are u still creating a itterator for that one in my main program?
Topic archived. No new replies allowed.