
2 May
2005
2 May
'05
6:45 p.m.
Dave Harris schrieb:
For example, from looking at the implementation it seems that the macro caches the end() value in a variable called _foreach_end.
(...)
Incidently, if it is caching then code like:
BOOST_FOREACH( int i, vec ) if (condition(i)) vec.push_back( filter(i) );
will not work the same as:
for (iterator i = vec.begin(); i != vec.end(); ++i) if (condition(*i)) vec.push_back( filter(*i) );
it is cached, but why? end is end and stays end, unless it is invalidated. -- Stefan Strasser