Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > std::vector fast access

Reply
Thread Tools

std::vector fast access

 
 
Chris Forone
Guest
Posts: n/a
 
      07-12-2008
hello group,

for std::vector, what access is faster from experience, the index or via
iterator?

thanks!

cheers, chris
 
Reply With Quote
 
 
 
 
Juha Nieminen
Guest
Posts: n/a
 
      07-12-2008
Chris Forone wrote:
> for std::vector, what access is faster from experience, the index or via
> iterator?


Why don't you measure it?

In most implementations, when not compiling in debug mode, indexing a
std::vector is basically a "pointer[index]" operation, and using an
iterator is identical to using a pointer. Which one is faster depends on
a lot of things.
 
Reply With Quote
 
 
 
 
Daniel T.
Guest
Posts: n/a
 
      07-12-2008
On Jul 12, 6:11*am, Chris Forone <(E-Mail Removed)> wrote:

> for std::vector, what access is faster from experience, the index or via
> iterator?


I'd be suprised if there is any measurable difference at all,
especially in a real world application.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANN] macstl 0.2 -- portable SIMD toolkit, fast valarray transcendentals, fast Mach vectors glenlow@pixelglow.com C++ 0 02-02-2005 12:32 PM
More memory: How fast is fast rfdjr1@optonline.net Computer Support 5 05-19-2004 05:45 PM
Canon S30 Fast shutter mode... Why so fast? mark popp Digital Photography 1 02-08-2004 10:07 PM
I NEED HELP FAST!!!!! REAL FAST!!!!! R. Jizzle MCSE 3 09-29-2003 08:51 PM
Super-fast AA Chargers: Anything as fast as the 15 minute Rayovac? David Chien Digital Photography 4 08-30-2003 07:49 PM



Advertisments