JustSomeGuy wrote:
I want to go through a std::list backwards....
std::list<mytype>::reverse_iterator it;
for (it=out.rbegin(); it != out.rend(); --it)
{
...
}
Looks correct. The only thing is that if you modify the list in the
middle of iterating through it, the iterator _may_ become invalid. If
your '...' contain something like
out.erase(it);
then it's a mistake because 'it' is invalid after that. Also, there
seems to be no need to declare 'it' outside of the 'for'. Keep it tight:
for (std::list<mytype>::reverse_iterator it = out.rbegin(); ...
V
--
Please remove capital As from my address when replying by mail