P
Philip Mueller
Hi,
I have two nested for loops which look like this with my selfmade list
implementation:
for (sShip *s = Ships; s; s = s->next)
for (sShip *s2 = s->next; s2; s2 = s2->next)
{...}
Now how can I do this with stl lists and the iterators? The most
difficult thing is the start of the inner loop.
My outer loop would look like this:
for (list<cShip>::iterator iShip = Ships.begin(); iShip != Ships.end();
++iShip)
But of course I can't begin the second loop with iShip->next.....
Any hints?
Regards
Philip
I have two nested for loops which look like this with my selfmade list
implementation:
for (sShip *s = Ships; s; s = s->next)
for (sShip *s2 = s->next; s2; s2 = s2->next)
{...}
Now how can I do this with stl lists and the iterators? The most
difficult thing is the start of the inner loop.
My outer loop would look like this:
for (list<cShip>::iterator iShip = Ships.begin(); iShip != Ships.end();
++iShip)
But of course I can't begin the second loop with iShip->next.....
Any hints?
Regards
Philip