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

Pages: 123
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/
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.
I agree with JL ^
Topic archived. No new replies allowed.
Pages: 123