[Boost-bugs] [Boost C++ Libraries] #3643: Auto type deduction in 'foreach'

Subject: [Boost-bugs] [Boost C++ Libraries] #3643: Auto type deduction in 'foreach'
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-11-19 11:22:23


#3643: Auto type deduction in 'foreach'
--------------------------------+-------------------------------------------
 Reporter: akrzemi1@… | Owner: eric_niebler
     Type: Feature Requests | Status: new
Milestone: Boost 1.42.0 | Component: foreach
  Version: Boost 1.41.0 | Severity: Problem
 Keywords: |
--------------------------------+-------------------------------------------
 I would like to request a new tool in Boost.Foreach that
 would emulate the following C++0x construct:

   for( auto const& x : collection ) { ... }

 It would look something like:

   BOOST_FOREACH_AUTO( const& x, collection ) {...}

 To prove it is doable I enclose the following suboptimal implementation as
 a proof of concept. It was already pointed out that the faster
 implementation is possible.

 #define BOOST_FOREACH_AUTO( INIT, CONT ) \
   BOOST_FOREACH( \
     BOOST_TYPEOF( *boost::begin(CONT) ) INIT, \
     CONT \
   )

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3643>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC