|
From: Cromwell E. <sp...@ya...> - 2006-06-19 22:36:14
|
--- Aurimas Äernius wrote:
> Hi,
Hello!
> > what happens if, when a running for_each, you
> > need to change the iterators that you originally
> > passed, from within the function that you call?
> >
> > specifically, what if the list changes size?
>
> If you add or remove elements from the list, all
> iterators become invalid. Of course you can try
> using them and you might succeed, but shouldn't
> do that. Just think that after any insertion or
> removal all iterator don't work anymore.
Only for certain containers (i.e. std::vector). For
std::list or std::set only the iterator pointing to
the element just removed becomes invalid.
Cromwell D. Enage
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|