On Thursday 02 of February 2012, Stephan Bergmann wrote: > On 02/02/2012 11:26 AM, Lubos Lunak wrote: > > I agree with all the points, but in Julien's defense, I remember > > exactly this same approach was pushed in recently as a fix to the same > > issue elsewhere. > > Might well be, I probably didn't notice. And this is in no way meant to > criticize Julien -- but I assume that's clear, anyway. > > > Perhaps we should agree on what the recommended way is? I personally > > think > > Don't think its worth to go any more formal here. I occasionally notice > things and give comments, trying to give rationales as well. But in the > end, all those kinds of code are good and fine, anyway.
I definitely didn't mean to get formal here, I simply meant a description of how to actually handle this, as it turns up now and then, and STL doesn't make this trivial. > > the simplest and most elegant solution is to go with 'it = > > container.erase( it );" and move the "++it" out of for()'s parentheses to > > an else block of the > > it = erase(it) is unfortunately only C++11 Oh, it's a map. Bugger. Ok, especially in that case it might be useful to point out that the solution is to use a temporary iterator for removal and advance the real one first. I can't be the only one who'd need a while to figure it out otherwise. -- Lubos Lunak [email protected] _______________________________________________ LibreOffice mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice
