Boost logo

Boost :

Subject: Re: [boost] [foreach] Request for auto type deduction
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-11-16 12:36:39


Andrzej Krzemienski wrote:

> Therefore, I would like to request a new tool in Boost.Foreach that
> would emulate the above construct, and would look something like:
>
> BOOST_FOREACH_AUTO( const& x, collection ) {...}
>
> I do not anticipate any technical difficulties with implementing this,
> as it can already be achiever with a verbose:
>
> BOOST_FOREACH( BOOST_TYPEOF( boost::begin(collection) ) const& x,
> collection ) {..}

Actually, I think it has the potential of being more efficient than
BOOST_FOREACH, which uses tricks that have some overhead on certain
compilers.
So it should not be implemented in terms of BOOST_FOREACH.


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