Boost logo

Boost :

Subject: Re: [boost] [foreach][assign] Does foreach work with assign::list_of?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-06-14 04:16:08


On 14/06/2011 06:55, Eric Niebler wrote:

>> Or BOOST_FOREACH could be changed to work differently.
>
> Sure. Just tell me how else to detect const rvalues in standard C++98.

Implementation of BOOST_FOREACH seems, large, quirky, and to contain
quite a few limitations.

With Boost.Typeof or decltype, I can write a robust implementation in a
couple of lines that is also likely to yield better code.

With compilers evolving, we could make the implementation of
BOOST_FOREACH evolve too.

It would also be nice to strip extra parentheses on compilers that are
capable of it, add BOOST_FOREACH_AUTO variants, and be able to leverage
native foreach-support where available.

I've already had a variant of BOOST_FOREACH that does that in my code
for years.
Legacy compatibility is nice, but a tool that allows to make the best of
ranges on today's compilers is very important too.


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