STL iterators and for loops

Terrence Enger tenger at iseries-guru.com
Fri Feb 28 07:38:46 PST 2014


On Fri, 2014-02-28 at 10:06 +0100, Stephan Bergmann wrote:
> On 02/28/2014 06:42 AM, Tor Lillqvist wrote:
> >> My builds with --enable-dbgutil are noticeably slow,
> >> OTOH, hoisting vec.end() so
> >> that is is called only once should be a quite mechanical task,
> >
> > Mechanical tasks are typically those where it is very easy to miss
> > some crucial detail in some case and introduce a bug.
> 
> ...like cases that purposefully keep re-evaluating end() because it gets 
> invalidated in the loop's body.
> 
> Also, hoisting the variable typically doesn't make the code more 
> readable, and all this will eventually become moot with C++11 anyway.
> 
> Stephan

Thank you, Tor and Stephan.

Terry.



More information about the LibreOffice mailing list