c++ - STL iterators: Prefix increment faster? -
possible duplicates:
preincrement faster postincrement in c++ - true? if yes, why it?
is there performance difference between i++ , ++i in c++?
i got told when using stl , it's iterators, should use ++iter
instead of iter++
.
i quote:
because can faster, never slower
is true?
yes. true in general. postfix increment burdened task of preserving , returning old value of iterator. takes time , effort, makes slower.
it true overloaded increment/decrement operators implement traditional pre/post semantics.
this topic beaten death. search here on "prefix postfix" large number of more detailed explanations.
Comments
Post a Comment