On 03/02/12 17:21, Stephan Bergmann wrote: > On 02/03/2012 04:18 PM, Michael Stahl wrote: >> On 03/02/12 14:01, Stephan Bergmann wrote: >>> The "standard idiom" is >>> >>> for (iterator i = m.begin(); i != m.end();) { >>> if (doErase) { >>> m.erase(i++); >>> } else { >>> ++i; >>> } >>> } >> >> but doesn't that have the same problem? "i" is incremented only after >> the erase is complete, when "i" is already invalid. > > No, i is incremented before calling erase in the above code.
ah, that's surprising. see, that is why i almost always write the i++ as an extra statement, i'm never quite exactly sure what it does, and when :) _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice