|
Boost : |
From: Stefan Strasser (sstrasser_at_[hidden])
Date: 2005-05-02 13:45:31
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk