
2 Dec
2004
2 Dec
'04
12:07 p.m.
Eric Niebler wrote:
Vladimir Prus wrote:
Eric, I've some questions about BOOST_FOREACH (which is pretty cool, BTW).
Thanks!
1. Is it possible to use typeof on gcc, to avoid any possible overhead? While you've posted some results which show that gcc generally can optimise it very well, I'd like to be 100% sure). Something like:
#define FOR_EACH(var, container) \ for(typeof(container.begin()) _for_each_i = container.begin(),\ _for_each_e = container.end();\ _for_each_i != _for_each_e; ++_for_each_i)\ if(bool _for_each_continue = false) {}\ else\ for(var = *_for_each_i; !_for_each_continue; _for_each_continue=true)
which works perfectly for me.
Why not use boost::range? Then boost::begin(container)...