Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74986 - trunk/boost
From: eric_at_[hidden]
Date: 2011-10-16 15:05:55


Author: eric_niebler
Date: 2011-10-16 15:05:55 EDT (Sun, 16 Oct 2011)
New Revision: 74986
URL: http://svn.boost.org/trac/boost/changeset/74986

Log:
a different fix for gcc-4.4
Text files modified:
   trunk/boost/foreach.hpp | 35 +++++------------------------------
   1 files changed, 5 insertions(+), 30 deletions(-)

Modified: trunk/boost/foreach.hpp
==============================================================================
--- trunk/boost/foreach.hpp (original)
+++ trunk/boost/foreach.hpp 2011-10-16 15:05:55 EDT (Sun, 16 Oct 2011)
@@ -33,7 +33,9 @@
 // Some compilers support rvalue references and auto type deduction.
 // With these C++0x features, temporary collections can be bound to
 // rvalue references and their lifetime is extended. No copy/move is needed.
-#if !defined(BOOST_NO_DECLTYPE) && !defined(BOOST_NO_RVALUE_REFERENCES)
+#if !defined(BOOST_NO_DECLTYPE) && !defined(BOOST_NO_RVALUE_REFERENCES) \
+ && !(BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ == 4) && !defined(BOOST_INTEL) && \
+ !defined(BOOST_CLANG))
 # define BOOST_FOREACH_USE_RVALUE_REFERENCE_BINDING
 // Some compilers let us detect even const-qualified rvalues at compile-time
 #elif !defined(BOOST_NO_RVALUE_REFERENCES) \
@@ -1052,49 +1054,22 @@
 
 namespace boost { namespace foreach_detail_
 {
- template<typename Cond, typename T>
- inline typename boost::mpl::if_<Cond, T const, T>::type &add_const_if(T &t)
- {
- return t;
- }
-
     template<typename T>
     typename remove_cv<typename decay<T>::type>::type decay_copy(T &&);
     
     template<typename T>
     T const add_const_if_rvalue(T &&);
 }}
-
-# define BOOST_FOREACH_IS_RVALUE(COL) \
- (true ? 0 : boost::foreach_detail_::is_rvalue(COL))
-
-# if (BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ == 4) && !defined(BOOST_INTEL) && !defined(BOOST_CLANG))
-# define BOOST_FOREACH_AUTO_OBJECT(NAME, EXPR) \
- if (bool BOOST_PP_CAT(NAME, _defined) = false) {} else \
- for (auto NAME = (EXPR); !BOOST_PP_CAT(NAME, _defined); BOOST_PP_CAT(NAME, _defined) = true)
-# else
-# define BOOST_FOREACH_AUTO_OBJECT(NAME, EXPR) \
+# define BOOST_FOREACH_AUTO_OBJECT(NAME, EXPR) \
     if (bool BOOST_PP_CAT(NAME, _defined) = false) {} else \
     for (decltype(boost::foreach_detail_::decay_copy(EXPR)) NAME = (EXPR); \
         !BOOST_PP_CAT(NAME, _defined); BOOST_PP_CAT(NAME, _defined) = true)
-# endif
 
 // If EXPR is an rvalue, bind it to a const rvalue reference.
-# if (BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ == 4) && !defined(BOOST_INTEL) && !defined(BOOST_CLANG))
-# define BOOST_FOREACH_AUTO_REF_REF(NAME, EXPR) \
- if (bool BOOST_PP_CAT(NAME, _tmp_defined) = false) {} else \
- for (auto &&BOOST_PP_CAT(NAME, _tmp) = (EXPR); \
- !BOOST_PP_CAT(NAME, _tmp_defined); BOOST_PP_CAT(NAME, _tmp_defined) = true) \
- if (bool BOOST_PP_CAT(NAME, _defined) = false) {} else \
- for (auto &&NAME = boost::foreach_detail_::add_const_if< boost::is_rvalue_reference<decltype( (EXPR) ) &&> >( \
- BOOST_PP_CAT(NAME, _tmp)); \
- !BOOST_PP_CAT(NAME, _defined); BOOST_PP_CAT(NAME, _defined) = true)
-# else
-# define BOOST_FOREACH_AUTO_REF_REF(NAME, EXPR) \
+# define BOOST_FOREACH_AUTO_REF_REF(NAME, EXPR) \
     if (bool BOOST_PP_CAT(NAME, _defined) = false) {} else \
     for (decltype(boost::foreach_detail_::add_const_if_rvalue(EXPR)) &&NAME = (EXPR); \
         !BOOST_PP_CAT(NAME, _defined); BOOST_PP_CAT(NAME, _defined) = true)
-# endif
 
 #elif defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION)
 ///////////////////////////////////////////////////////////////////////////////


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk