Michael Marcin | 13 Oct 18:12
Picon

Re: Geometry and spatial indexes, my opinion

Mathias Gaunard wrote:
> 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.
> 

At least with MSVC9 they aren't exactly equivalent.

http://lists.boost.org/Archives/boost/2008/09/142657.php

--

-- 
Michael Marcin

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Gmane