[RFC] A comment in string::_S_construct(input_iterator)
Paolo Carlini
pcarlini@suse.de
Sat Jan 17 11:49:00 GMT 2004
Hi,
there is a long standing comment in the code special cased for
Input Iterators that I have trouble understanding completely:
// NB: this loop looks precisely this way because
// it avoids comparing __beg != __end any more
// than strictly necessary; != might be expensive!
Of course, in the loop __beg == __end appears.
So, sorry for my naive question: when Input Iterators are
involved is != in any non-trivial way different from ==?
Or the comment is really about _comparing_ Input Iterators?
In that case, the chosen loop is really able to reduce the
number of comparisons? Which are the (so bad) alternatives?
Thanks for any help,
Paolo.
More information about the Libstdc++
mailing list