quote:Original post by alnite
In my case, where the iterator is a class, do you think there's a difference between preincrement and postincrement operators? The operators are overloaded, so the speed depends on how the class overload these operators.
As I said: "A simple rule of thumb is to always use preincrement whenever possible, and only use postincrement if you really need it."
The preincrement operator will return a reference to the iterator after the increment.
The postincrement operator will return a copy of the iterator before the increment.
As copying an iterator could be an expensive operation, you should stick to the preincrement operator.
Update GameDev.net system time campaign - success at last
[edited by - dalleboy on April 2, 2003 4:24:39 AM]