Re: [Boost-bugs] [Boost C++ Libraries] #5475: [Foreach] rvalue reference binding of temporary ranges

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5475: [Foreach] rvalue reference binding of temporary ranges
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-10-20 16:34:58


#5475: [Foreach] rvalue reference binding of temporary ranges
--------------------------------------+-------------------------------------
  Reporter: mimomorin@… | Owner: eric_niebler
      Type: Patches | Status: closed
 Milestone: To Be Determined | Component: foreach
   Version: Boost Development Trunk | Severity: Problem
Resolution: fixed | Keywords: foreach, C++0x
--------------------------------------+-------------------------------------

Comment (by Michel Morin <mimomorin@…>):

 ***Regressions for compilers supporting C++11 lambda***

 Because the current C++11 BOOST_FOREACH uses `decltype` rather than
 `auto`,
 it cannot be used with C++11 lambda.
 This is possibly a serious regression.
 The following code compiles fine on VC++10 and gcc 4.5-4.7 with Boost
 1.47,
 but fails to compile with Boost trunk:
 {{{
 #include <iostream>
 #include <vector>
 #include <boost/foreach.hpp>
 #define BOOST_RESULT_OF_USE_DECLTYPE
 #include <boost/range/adaptor/transformed.hpp>

 int main (int argc, char* argv[])
 {
     std::vector<int> v(3, 0);

     BOOST_FOREACH(int x, v | boost::adaptors::transformed([](int i){
 return i + 1; }))
     {
         std::cout << x << std::endl;
     }

     return 0;
 }
 }}}
 I know the release branch is already closed,
 but how about deferring C++11 support to Boost 1.49?

 Sorry for repeatedly troubling you.
 I should have noticed this regression earlier and
 I shouldn't have used `decltype` to workaround gcc's `auto` bugs.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5475#comment:31>
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:07 UTC