Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77398 - trunk/boost
From: lorcaminiti_at_[hidden]
Date: 2012-03-18 20:14:53


Author: lcaminiti
Date: 2012-03-18 20:14:52 EDT (Sun, 18 Mar 2012)
New Revision: 77398
URL: http://svn.boost.org/trac/boost/changeset/77398

Log:
Fixed a bug that on MSVC did not expand `()` around `this` when constructing params struct with only 1 capture for this_.
Workaround MSVC PP problem in dealing with empty params by trailing EMPTY as in `BOOST_PP_IS_EMPTY(ty BOOST_PP_EMPTY())`.
Text files modified:
   trunk/boost/scope_exit.hpp | 23 ++++++++++++-----------
   1 files changed, 12 insertions(+), 11 deletions(-)

Modified: trunk/boost/scope_exit.hpp
==============================================================================
--- trunk/boost/scope_exit.hpp (original)
+++ trunk/boost/scope_exit.hpp 2012-03-18 20:14:52 EDT (Sun, 18 Mar 2012)
@@ -283,8 +283,8 @@
 #else // TYPEOF_THIS_WORKAROUND
 
 #define BOOST_SCOPE_EXIT_DETAIL_TYPEDEF_TYPEOF_THIS(id, ty, new_type) \
- typedef \
- BOOST_PP_IIF(BOOST_PP_IS_EMPTY(ty), \
+ typedef /* trailing `EMPTY()` handles empty `ty` */ \
+ BOOST_PP_IIF(BOOST_PP_IS_EMPTY(ty BOOST_PP_EMPTY()), \
             BOOST_TYPEOF \
         , \
             BOOST_TYPEOF_TPL \
@@ -316,7 +316,7 @@
         } /* trailing `;` will be added by the caller */ \
     )
 
-#else
+#else // TPL_WORKAROUND
 
 #define BOOST_SCOPE_EXIT_AUX_CTOR_ARG(r, id, i, var) \
     BOOST_PP_COMMA_IF(i) \
@@ -365,15 +365,16 @@
     BOOST_PP_COMMA_IF(i) BOOST_SCOPE_EXIT_AUX_DEREF(id,i,var)
 
 #define BOOST_SCOPE_EXIT_AUX_PARAMS_INIT(id, captures, has_this) \
- BOOST_PP_LPAREN_IF(BOOST_PP_LIST_IS_CONS(captures)) \
- BOOST_PP_LIST_FOR_EACH_I(BOOST_SCOPE_EXIT_DETAIL_PARAM_INIT, id, \
- captures)\
- BOOST_PP_COMMA_IF(BOOST_PP_BITAND(BOOST_PP_LIST_IS_CONS(captures), \
- has_this)) \
- BOOST_PP_EXPR_IIF(has_this, this) \
- BOOST_PP_RPAREN_IF(BOOST_PP_LIST_IS_CONS(captures))
+ BOOST_PP_LPAREN_IF(BOOST_PP_BITOR(has_this, \
+ BOOST_PP_LIST_IS_CONS(captures))) \
+ BOOST_PP_LIST_FOR_EACH_I(BOOST_SCOPE_EXIT_DETAIL_PARAM_INIT, id, captures) \
+ BOOST_PP_COMMA_IF(BOOST_PP_BITAND(BOOST_PP_LIST_IS_CONS(captures), \
+ has_this)) \
+ BOOST_PP_EXPR_IIF(has_this, this) \
+ BOOST_PP_RPAREN_IF(BOOST_PP_BITOR(has_this, \
+ BOOST_PP_LIST_IS_CONS(captures)))
 
-#endif
+#endif // TPL_WORKAROUND
 
 #if defined(BOOST_TYPEOF_EMULATION)
 


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