Boost logo

Boost :

Subject: Re: [boost] BOOST_FOREACH slow?
From: Peter Bartlett (pete_at_[hidden])
Date: 2008-11-17 13:29:16

Rest easy Hansi, I think your test is invalid.

You write:
> vector[TestData]: iterator:0.00167619
> vector[TestData]: BOOST_FOREACH:9.40008

I too get this result I don't do anything with "res".
If I add res to the lines that are printed to cout to stop the
compiler doing so much dead code elimination I get the following

vector[TestData]: iterator:32.1508
vector[TestData]: BOOST_FOREACH:30.584

[I won't read too much into FOREACH being faster either... in my
experience the difference between iterators and FOREACH is lost in the
noise of things beyond your control in all but the most extreme cases.]


Boost list run by bdawes at, gregod at, cpdaniel at, john at