Boost logo

Boost :

From: Neal D. Becker (ndbecker2_at_[hidden])
Date: 2004-12-02 07:07:07


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)...


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk