Boost logo

Geometry :

Subject: [ggl] pre-/post-increment op on iterators
From: Barend Gehrels (Barend.Gehrels)
Date: 2009-04-25 17:23:34

Hi Mateusz,

> I've noticed that in many (if not most) places where iterators
> are used, they are advanced using post-increment operator
> instead of the pre-increment one.
> Is this intentional?
Yes and no, more bad (old) habit then intentional. Pre-increment seems
to perform better so if that is really the case, we should change it.
We've tools to check that :-) Just checked, see below.
> If not, I'd like to change it to pre-increment
> as well as propose to add development guideline recommending
> use of pre-increment operator over the post-increment.
Yes, please. I just compared the difference using convex hull. Did you
already check the comparison programs? Anyway, our convex hull seems to
perform quite good compared with others. Using iterator pre-increment
instead of post-increment (in agn_convex_hull.hpp) makes it another 1.8%
faster. So although not shocking, it is a measurable improvement (from
0.828 to 0.813 seconds).

So yes, we should change it. Good you point it out.


Geometry list run by mateusz at