list<...>::iterator question

I have a list of triangles. Each triangle points to three other triangles. Is there a way I can have a second iterator directly access the triangles in the list that each is pointing to?

list<triangle> triL;
list<triangle>:: tritr, tritr2;

tritr = triL.begin();
while(tritr != triL.end())
{
tritr2 = tritr->getTriPntr1();
/*
Above is where I would like tritr2 to be point at the same
triangle that tritr's TriPntr1 is pointing at.
*/

tritr++;
}
Is there a way I can have a second iterator directly access the triangles in the list that each is pointing to?

I don't understand what do you want to do. To access the elements you need to * the iterator. (I don't know how it sounds in English, maybe 'dereference'). list<...>::iterator is a bidirectional iterator by default.
But if tritr is point at a triangle many nodes away in the list. I would like to be able to have tritr2 go directly there without having to iterate up or down to get there.
Just do tritr2 = tritr. I haven't understood you again.
Topic archived. No new replies allowed.