why ++i is better than i++ (when applicable)

Pages: 123
AndreyKarpov (5)
Is it reasonable to use the prefix increment operator ++it instead of postfix operator it++ for iterators? - http://www.cplusplus.com/forum/lounge/91220/2/
JLBorges (1754)
For every type that supports increment/decrement, be it a scalar type like int or a user-defined type like the iterator of a std::list:

By default, use the prefix version of the increment/decrement operator.
Use the postfix version if and only if you need a copy of the object before it was incremented/decremented

And you can't go wrong.
L B (3806)
I agree with JL ^
Registered users can post here. Sign in or register to post.
Pages: 123