Re: Performance: Iterating a vector in a loop..
- From: "Simon Trew" <ten.enagro@werts>
- Date: Fri, 27 May 2005 01:06:53 +0100
"andré m.a" <a.m.a@xxxxxxxxxxxx> wrote in message
news:YArle.5230$8j3.220242@xxxxxxxxxxxxxxxxxxxxxx
>
> and im not sure if
>
> while( itLoop != itEnd )
> {
> (++itLoop)->DoSomething();
> }
>
> would be faster either.
since 'for' is more or less a bit of syntactic sugar for 'while', it would
more than likely be faster, since here you are missing off the first element
of the collection, so you're doing one iteration. of course, if itLoop ==
end() on entry to the loop, you have undefined behavior.
You'd need to use a post-increment or put the pre-increment after the call
to DoSomething.
S.
.
- Follow-Ups:
- Re: Performance: Iterating a vector in a loop..
- From: andré m.a
- Re: Performance: Iterating a vector in a loop..
- From: Simon Trew
- Re: Performance: Iterating a vector in a loop..
- From: Simon Trew
- Re: Performance: Iterating a vector in a loop..
- References:
- Performance: Iterating a vector in a loop..
- From: Mark Ingram
- Re: Performance: Iterating a vector in a loop..
- From: andré m.a
- Performance: Iterating a vector in a loop..
- Prev by Date: Re: Tree Expand
- Next by Date: Trouble retrieving File Summary Info from Office and NTFS documents
- Previous by thread: Re: Performance: Iterating a vector in a loop..
- Next by thread: Re: Performance: Iterating a vector in a loop..
- Index(es):