Linked List Help please

From: Shane (deja_NOSPAM__at_zaft.com)
Date: 08/11/04


Date: 10 Aug 2004 23:16:15 -0700

Thanks in advance for the help.

I'm new to the STL and havig a bit of trouble figuring out the whole
iterator thing. I am using the <list> template and I can insert
elements into the list just fine. I just can't get them out. It's
like the roach motel! (uh, you can go in, but don't come out...
anyway...)

Actually, I have been able to get some help from
http://www.sgi.com/tech/stl/List.html

I can get the forst element or the last, but I can't find one
in-between or pick one out like you would in an array by referencing
the element number.

Can someone give me a hand or point me to a tutorial? I have found a
lot of tutorials, but all of them use ints as elements in the list,
and I need to store objects.

#import<list>

list<People::People> PP;

//person is a People
person.setName("Shane");

PP.push_back(person);

Now the person has been added to the linked list. I can get it out by
saying

person2 = PP.front();
cout << person2.getName();

but this is only if the person is at the front of the linked list.

Any suggestions? I know it's all there at
http://www.sgi.com/tech/stl/List.html in black and white. I just
don't understand it.

Shane