Boost logo

Boost :

Subject: Re: [boost] Geometry and spatial indexes, my opinion
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2008-10-11 12:10:45


Brandon Kohn wote:

> If so, how does direct iteration compare with index
> operator accesses? I've noticed in my own tests on measuring std::vector
> accesses that iteration is significantly faster than operator [ ] when
> you are iterating over the container (presumably due to bounds checking).

operator[] doesn't do bounds checking, unless you have the debug/secure
mode of your standard library enabled (which is on by default on MSVC).

While access by index is theoretically slower than pointer increments,
I'm pretty sure any compiler optimizes the former to the latter.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk