My workmate claims that for object types preincrement is more efficient than post increment
e.g.
std::vector vec;
... insert a wh
For primitive types, I used to do this. It used to get me about 10% boost in many programs on Visual Studio back in 1998/1999. Shortly after that, they fixed their optimizer. The post increment operator created a variable on the stack, copied the value, incremented the source, and then removed the variable from the stack. Once the optimizers detected it was not being used, the benefit went away.
Most people did not stop coding that way. :) It took me a few years.
For objects, I am not sure how that would work. I assume a copy operator would be required for a true implementation of post increment. It would have to make a copy and use the copy for the operations, and increment the source.
Jacob