I decided to find out if there is practical sense in writing ++iterator instead of iterator++ when handling iterators.
Is it reasonable to use the prefix increment operator ++it instead of postfix operator it++ for iterators?
by Andrey Karpov
From the article:
I will always write ++it. I did so before but I did it "just in case". Now I can see how useful it is because I regularly launch debug versions. In general, of course, ++it has a very slight influence on the running time. But if I don't make such small optimizations in different places of the code, it will be too late and the profiler won't help me. Bottlenecks will be spread throughout the code.
Add a Comment
Comments are closed.