|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r76375 - in sandbox/closure/boost: . closure/aux_ closure/aux_/macro/code_ typeof
From: lorcaminiti_at_[hidden]
Date: 2012-01-08 17:23:56
Author: lcaminiti
Date: 2012-01-08 17:23:54 EST (Sun, 08 Jan 2012)
New Revision: 76375
URL: http://svn.boost.org/trac/boost/changeset/76375
Log:
Patched latest scope_exit to detect this type (no typeof modification needed after all).
Removed:
sandbox/closure/boost/typeof/
Text files modified:
sandbox/closure/boost/closure/aux_/function.hpp | 13 +
sandbox/closure/boost/closure/aux_/macro/code_/bind.hpp | 22 +-
sandbox/closure/boost/closure/aux_/macro/code_/functor.hpp | 16 ++
sandbox/closure/boost/scope_exit.hpp | 299 +++++++++++++++++----------------------
4 files changed, 175 insertions(+), 175 deletions(-)
Modified: sandbox/closure/boost/closure/aux_/function.hpp
==============================================================================
--- sandbox/closure/boost/closure/aux_/function.hpp (original)
+++ sandbox/closure/boost/closure/aux_/function.hpp 2012-01-08 17:23:54 EST (Sun, 08 Jan 2012)
@@ -32,6 +32,13 @@
#define BOOST_CLOSURE_AUX_arg_type(z, arg_n, unused) \
BOOST_PP_CAT(A, arg_n)
+#define BOOST_CLOSURE_AUX_arg_typedef(z, arg_n, unused) \
+ typedef \
+ BOOST_CLOSURE_AUX_arg_type(z, arg_n, ~) \
+ /* name must follow Boost.FunctionTraits arg1_type, arg2_type, ... */ \
+ BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(arg_n)), _type) \
+ ;
+
#define BOOST_CLOSURE_AUX_comma_arg_tparam(z, arg_n, unused) \
, typename BOOST_CLOSURE_AUX_arg_type(z, arg_n, ~)
@@ -232,6 +239,12 @@
BOOST_CLOSURE_AUX_call_typedef, BOOST_CLOSURE_AUX_arity)
public:
+ // Provide public type interface following Boost.Function names
+ // (traits must be defined in both this and the local functor).
+ enum { arity = BOOST_CLOSURE_AUX_arity }; // More portable than static data.
+ typedef R result_type;
+ BOOST_PP_REPEAT(BOOST_CLOSURE_AUX_arity, BOOST_CLOSURE_AUX_arg_typedef, ~)
+
// NOTE: Must have default constructor for init without function name in
// function macro expansion.
Modified: sandbox/closure/boost/closure/aux_/macro/code_/bind.hpp
==============================================================================
--- sandbox/closure/boost/closure/aux_/macro/code_/bind.hpp (original)
+++ sandbox/closure/boost/closure/aux_/macro/code_/bind.hpp 2012-01-08 17:23:54 EST (Sun, 08 Jan 2012)
@@ -117,13 +117,18 @@
BOOST_SCOPE_EXIT_AUX_PARAM_INIT(r, id, i, \
BOOST_CLOSURE_AUX_PP_BIND_TRAITS_VAR_WITHOUT_TYPE(bind_traits))
-#define BOOST_CLOSURE_AUX_CODE_BIND_THIS_TYPEDEF_TYPED_(all_bind_this_types) \
- typedef BOOST_CLOSURE_AUX_PP_BIND_TRAITS_THIS_TYPE(BOOST_PP_LIST_FIRST( \
- all_bind_this_types))
-
-#define BOOST_CLOSURE_AUX_CODE_BIND_THIS_TYPEDEF_DEDUCED_(all_bind_this_types) \
- BOOST_SCOPE_EXIT_TYPEDEF_TYPEOF_THIS()
+#define BOOST_CLOSURE_AUX_CODE_BIND_THIS_TYPEDEF_DEDUCED_( \
+ id, all_bind_this_types) \
+ BOOST_SCOPE_EXIT_AUX_TYPEDEF_TYPEOF_THIS( \
+ BOOST_CLOSURE_AUX_CODE_BIND_THIS_TYPE(id))
+#define BOOST_CLOSURE_AUX_CODE_BIND_THIS_TYPEDEF_TYPED_(all_bind_this_types) \
+ typedef \
+ BOOST_CLOSURE_AUX_PP_BIND_TRAITS_THIS_TYPE(BOOST_PP_LIST_FIRST( \
+ all_bind_this_types)) \
+ BOOST_CLOSURE_AUX_CODE_BIND_THIS_TYPE(id) \
+ ;
+
#define BOOST_CLOSURE_AUX_CODE_BIND_THIS_TYPEDEF_(id, all_bind_this_types) \
/* typedef type_ */ \
BOOST_PP_IIF(BOOST_PP_IS_EMPTY(BOOST_CLOSURE_AUX_PP_BIND_TRAITS_THIS_TYPE( \
@@ -133,10 +138,7 @@
BOOST_CLOSURE_AUX_CODE_BIND_THIS_TYPEDEF_DEDUCED_ \
, \
BOOST_CLOSURE_AUX_CODE_BIND_THIS_TYPEDEF_TYPED_ \
- )(all_bind_this_types) \
- /* this_type ## id */ \
- BOOST_CLOSURE_AUX_CODE_BIND_THIS_TYPE(id) \
- ; /* close typedef */
+ )(id, all_bind_this_types)
// Adapted from `BOOST_SCOPE_EXIT_AUX_IMPL()`.
#define BOOST_CLOSURE_AUX_CODE_BIND_ALL_( \
Modified: sandbox/closure/boost/closure/aux_/macro/code_/functor.hpp
==============================================================================
--- sandbox/closure/boost/closure/aux_/macro/code_/functor.hpp (original)
+++ sandbox/closure/boost/closure/aux_/macro/code_/functor.hpp 2012-01-08 17:23:54 EST (Sun, 08 Jan 2012)
@@ -85,6 +85,15 @@
BOOST_CLOSURE_AUX_CODE_FUNCTOR_F_TYPE_ \
>::BOOST_PP_CAT(BOOST_PP_CAT(arg, i), _type) \
+#define BOOST_CLOSURE_AUX_CODE_FUNCTOR_ARG_TYPEDEF_( \
+ r, typename01, i, param_traits) \
+ typedef \
+ BOOST_CLOSURE_AUX_CODE_FUNCTOR_PARAM_ARG_TYPE_(typename01, \
+ BOOST_PP_INC(i)) \
+ /* name must follow Boost.FunctionTraits arg1_type, arg2_type, ... */ \
+ BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(i)), _type) \
+ ;
+
#define BOOST_CLOSURE_AUX_CODE_FUNCTOR_PARAM_ARG_DECL_( \
r, typename01, i, param_traits) \
BOOST_PP_EXPR_IIF(typename01, typename) \
@@ -697,6 +706,13 @@
const_binds, has_const_bind_this, binds, has_bind_this, \
id, typename01) \
public: \
+ /* public trait interface following Boost.FunctionTraits names */ \
+ /* (traits must be defined in both this and the global functor) */ \
+ enum { arity = ::boost::function_traits< /* can't use static data */ \
+ BOOST_CLOSURE_AUX_CODE_FUNCTOR_F_TYPE_ >::arity }; \
+ typedef BOOST_CLOSURE_AUX_CODE_RESULT_TYPE(id) result_type; \
+ BOOST_PP_LIST_FOR_EACH_I(BOOST_CLOSURE_AUX_CODE_FUNCTOR_ARG_TYPEDEF_, \
+ typename01, params) \
/* constructor */ \
inline explicit BOOST_CLOSURE_AUX_CODE_FUNCTOR_CLASS_TYPE_(id)( \
void* BOOST_CLOSURE_AUX_CODE_FUNCTOR_PARAMS_) \
Modified: sandbox/closure/boost/scope_exit.hpp
==============================================================================
--- sandbox/closure/boost/scope_exit.hpp (original)
+++ sandbox/closure/boost/scope_exit.hpp 2012-01-08 17:23:54 EST (Sun, 08 Jan 2012)
@@ -1,9 +1,4 @@
-
-// Copyright (C) 2009-2011 Lorenzo Caminiti
-// Use, modification, and distribution is subject to the Boost Software
-// License, Version 1.0 (see accompanying file LICENSE_1_0.txt or a
-// copy at http://www.boost.org/LICENSE_1_0.txt).
-
+// Copyright Alexander Nasonov 2006-2009, 2011
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -14,7 +9,58 @@
#include <boost/config.hpp>
+#if !defined(BOOST_NO_LAMBDAS) \
+ && !defined(BOOST_NO_AUTO_DECLARATIONS) \
+ && !defined(BOOST_SCOPE_EXIT_FORCE_CXX98)
+#define BOOST_SCOPE_EXIT_AUX_CXX0X
+#endif
+
+#if defined(BOOST_SCOPE_EXIT_AUX_CXX0X)
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/seq/enum.hpp>
+
+namespace boost { namespace scope_exit { namespace aux {
+
+template<class F>
+struct guard
+{
+ F fn_;
+ guard(F f) : fn_(f) {}
+ ~guard() { fn_(); }
+};
+
+struct guard_maker
+{
+ template<class F>
+ guard<F> operator%(F f) const
+ {
+ return guard<F>(f);
+ }
+};
+
+} } }
+
+#define BOOST_SCOPE_EXIT_AUX_IMPL(id, seq) \
+ auto BOOST_PP_CAT(boost_se_fn_, id) = \
+ ::boost::scope_exit::aux::guard_maker() % \
+ [BOOST_PP_SEQ_ENUM(seq)]() mutable -> void
+
+#if defined(BOOST_MSVC)
+#define BOOST_SCOPE_EXIT(seq) BOOST_SCOPE_EXIT_AUX_IMPL(__COUNTER__, seq)
+#else
+#define BOOST_SCOPE_EXIT(seq) BOOST_SCOPE_EXIT_AUX_IMPL(__LINE__, seq)
+#endif
+
+#define BOOST_SCOPE_EXIT_TPL(seq) BOOST_SCOPE_EXIT(seq)
+
+#define BOOST_SCOPE_EXIT_END ;
+
+#else
+
#include <boost/detail/workaround.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/utility/enable_if.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/facilities/empty.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
@@ -22,7 +68,7 @@
#include <boost/preprocessor/seq/for_each_i.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#include <boost/preprocessor/facilities/identity.hpp>
-#include "typeof/typeof.hpp" // Local typeof with `this` MSVC workaround.
+#include <boost/typeof/typeof.hpp>
#if defined(__GNUC__) && !defined(BOOST_INTEL)
# define BOOST_SCOPE_EXIT_AUX_GCC (__GNUC__ * 100 + __GNUC_MINOR__)
@@ -36,7 +82,6 @@
// Steven Watanabe's trick with a modification suggested by Kim Barrett
namespace boost { namespace scope_exit { namespace aux {
-
// Type of a local boost_scope_exit_args variable.
// First use in a local scope will declare the boost_scope_exit_args
// variable, subsequent uses will be resolved as two comparisons
@@ -155,151 +200,89 @@
#define BOOST_SCOPE_EXIT_AUX_TAG_DECL(r, id, i, var) \
typedef void (*BOOST_SCOPE_EXIT_AUX_TAG(id,i))(int var);
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1300)
+// Boost.Typeof for VC71's typeid-based workaround does not work to determine
+// `this` type due to error C2355 being incorrectly reported. The typical
+// avoidance strategy implemented below is to make an indirect compile-time
+// constant by assigning an enum and use that as type-index-- this only works
+// with the sizeof() approach and not with the typeid() approach.
-//----begin-'this-capture'-detection-and-selection-mechanics----
+namespace boost { namespace scope_exit { namespace aux {
+namespace msvc_typeof_this {
+ template<int Id>
+ struct msvc_typeid_wrapper
+ {
+ typedef typename boost::type_of::msvc_extract_type<boost::mpl::int_<Id>
+ >::id2type id2type;
+ typedef typename id2type::type type;
+ };
+ template<>
+ struct msvc_typeid_wrapper<4>
+ {
+ typedef msvc_typeid_wrapper<4> type;
+ };
+
+/** @todo add authorships notes at top including contributer of this typeof workaround */
-#if BOOST_WORKAROUND(BOOST_MSVC,>=1300)
- // Boost.Typeof for VC71's typeid-based workaround does not work
- // to determine the type of 'this' due to error C2355 being
- // incorrectly reported (a compiler bug that's present in 8 and 9
- // also). The typical avoidance strategy to evade this error is
- // to make an indirect compile-time constant by assignment through
- // enum, then use that as a type-index. This cannot happen with
- // the typeid() approach, only with a sizeof() approach.
- //
- // The implementation below is the more general, type-index
- // sizeof()-based approach implemented in Boost.Typeof which
- // appears to work fine for typeof(this) provided the reference to
- // 'this' is not present in the template argument list (i.e. the
- // type-index is captured into a local enumerator before being
- // used as a template argument).
- //
- // Inline documentation is removed and conditional compilation
- // applied.
- //
- namespace boost { namespace scope_exit { namespace msvc_typeof_this
+ template<typename T>
+ struct encode_type
{
- template<int ID>
- struct msvc_typeid_wrapper {
- typedef typename boost::type_of::msvc_extract_type<mpl::int_<ID> >::id2type id2type;
- typedef typename id2type::type type;
- };
- template<>
- struct msvc_typeid_wrapper<4> {
- typedef msvc_typeid_wrapper<4> type;
- };
- template<typename T>
- struct encode_type
- {
- BOOST_STATIC_CONSTANT(unsigned,value=BOOST_TYPEOF_INDEX(T));
- typedef typename boost::type_of::msvc_register_type<T,mpl::int_<value> >::id2type type;
- BOOST_STATIC_CONSTANT(unsigned,next=value+1);
- BOOST_TYPEOF_NEXT_INDEX(next);
- };
- template<class T>
- struct sizer
- {
- typedef char(*type)[encode_type<T>::value];
- };
- template<typename T> typename disable_if<
- typename is_function<T>::type,
- typename sizer<T>::type>::type encode_start(T const&);
- template<typename T> typename enable_if<
- typename is_function<T>::type,
- typename sizer<T>::type>::type encode_start(T&);
- template<typename Organizer, typename T>
- boost::type_of::msvc_register_type<T,Organizer> typeof_register_type(const T&,Organizer* =0);
-
- }}}
-
-# define BOOST_SCOPE_EXIT_TYPEDEF_TYPEOF_THIS() \
- enum { BOOST_PP_CAT(boost_se_thistype_index_,__LINE__) = sizeof(*boost::scope_exit::msvc_typeof_this::encode_start(this)) }; \
- typedef boost::scope_exit::msvc_typeof_this::msvc_typeid_wrapper<BOOST_PP_CAT(boost_se_thistype_index_,__LINE__)>::type
+ BOOST_STATIC_CONSTANT(unsigned, value =
+ boost::type_of::encode_counter<T>::count);
+ typedef typename boost::type_of::msvc_register_type<T,
+ boost::mpl::int_<value> >::id2type type;
+ BOOST_STATIC_CONSTANT(unsigned, next = value + 1);
+// @todo remove friend char (*boost::type_of::encode_index(
+// boost::type_of::encode_counter<next>*))[next];
+ };
-#else // other Boost.Typeof 'this' appear to be okay
-# define BOOST_SCOPE_EXIT_TYPEDEF_TYPEOF_THIS() typedef BOOST_TYPEOF(this)
-#endif
+ template<class T>
+ struct sizer
+ {
+ typedef char(*type)[encode_type<T>::value];
+ };
-// 'this-capture' function-macros for when (*this) is requested
-//
-#define BOOST_SCOPE_EXIT_REALTHIS_COMMA_IF_this(seq) this BOOST_PP_COMMA_IF(BOOST_PP_SEQ_SIZE(seq))
-#define BOOST_SCOPE_EXIT_THISPARAM_COMMA_IF_this(id,seq) BOOST_PP_CAT(se_this_type,id) se_this BOOST_PP_COMMA_IF(BOOST_PP_SEQ_SIZE(seq))
-#define BOOST_SCOPE_EXIT_THISINIT_COMMA_IF_this(seq) se_this(se_this) BOOST_PP_COMMA_IF(BOOST_PP_SEQ_SIZE(seq))
-#define BOOST_SCOPE_EXIT_THISINIT_BEGIN_PARAM_T_INITLIST_this(seq) :
-#define BOOST_SCOPE_EXIT_HASARGS_this(seq) 1
-
-#define BOOST_SCOPE_EXIT_TYPEDEF_THISTYPE_this(id) BOOST_SCOPE_EXIT_TYPEDEF_TYPEOF_THIS() BOOST_PP_CAT(se_this_type,id);
-#define BOOST_SCOPE_EXIT_DEFINE_THISMEMBER_this(id) BOOST_PP_CAT(se_this_type,id) se_this;
-#define BOOST_SCOPE_EXIT_DEFINE_THIS_ACCESSOR_this(id) \
- inline BOOST_PP_CAT(se_this_type,id) operator->() { return boost_se_params_->se_this; } \
- inline BOOST_PP_CAT(se_this_type,id) operator*() { return boost_se_params_->se_this; } \
- inline operator BOOST_PP_CAT(se_this_type,id)() { return boost_se_params_->se_this; } \
+ template<typename T>
+ typename boost::disable_if<
+ typename boost::is_function<T>::type
+ , typename sizer<T>::type
+ >::type encode_start(T const&);
+ template<typename T>
+ typename boost::enable_if<
+ typename boost::is_function<T>::type
+ , typename sizer<T>::type
+ >::type encode_start(T&);
+
+ template<typename Organizer, typename T>
+ boost::type_of::msvc_register_type<T, Organizer> typeof_register_type(
+ const T&, Organizer* = 0);
+}}}} // namespace
+
+#define BOOST_SCOPE_EXIT_AUX_TYPEDEF_TYPEOF_THIS_INDEX_ \
+ BOOST_PP_CAT(boost_se_thistype_index_, __LINE__)
+
+#define BOOST_SCOPE_EXIT_AUX_TYPEDEF_TYPEOF_THIS(new_type) \
+ enum { BOOST_SCOPE_EXIT_AUX_TYPEDEF_TYPEOF_THIS_INDEX_ = sizeof(*::boost \
+ ::scope_exit::aux::msvc_typeof_this::encode_start(this)) }; \
+ typedef ::boost::scope_exit::aux::msvc_typeof_this::msvc_typeid_wrapper< \
+ BOOST_SCOPE_EXIT_AUX_TYPEDEF_TYPEOF_THIS_INDEX_ >::type new_type;
-// 'this-capture' function-macros for when (*this) is not requested
-//
-#define BOOST_SCOPE_EXIT_REALTHIS_COMMA_IF_nothis(seq)
-#define BOOST_SCOPE_EXIT_THISPARAM_COMMA_IF_nothis(id,seq)
-#define BOOST_SCOPE_EXIT_THISINIT_COMMA_IF_nothis(seq)
-#define BOOST_SCOPE_EXIT_THISINIT_BEGIN_PARAM_T_INITLIST_nothis(seq) BOOST_PP_IF(BOOST_PP_SEQ_SIZE(seq),BOOST_PP_IDENTITY(:),BOOST_PP_EMPTY)()
-#define BOOST_SCOPE_EXIT_HASARGS_nothis(seq) BOOST_PP_SEQ_SIZE(seq)
-
-#define BOOST_SCOPE_EXIT_TYPEDEF_THISTYPE_nothis(id)
-#define BOOST_SCOPE_EXIT_DEFINE_THISMEMBER_nothis(id)
-#define BOOST_SCOPE_EXIT_DEFINE_THIS_ACCESSOR_nothis(id)
+#else // typeof(this) on other compilers are OK.
-// Expand to 1 if the first sequence element is 'this'
-// or 0 otherwise.
-//
-// Mechanics: [given that 'this(x)' --> '(this(x))']
-//
-// head = front(seq) --> 'this' or 'somearg'
-// funcexp = head(_) --> '(this(_))' or 'somearg(_)'
-// size_and_possible_tokens = seq_size(funcexp)
-// yields either
-// 0 somearg(_)
-// or 1
-// expansion of 'cat(X,size_and_possible_tokens _) )'
-// yields either
-// X0 _ ) --> zero( _ ) --> 0
-// or X1 tokens _ ) --> one( tokens _ ) --> 1
-//
-// where X0 is BOOST_SCOPE_EXIT_HAS_THIS_CONSUME_0
-// X1 is BOOST_SCOPE_EXIT_HAS_THIS_CONSUME_1
-// zero() is BOOST_SCOPE_EXIT_HAS_THIS_FALSE()
-// one() is BOOST_SCOPE_EXIT_HAS_THIS_TRUE()
-//
-#define BOOST_SCOPE_EXIT_HAS_THIS(seq) \
- BOOST_PP_CAT(BOOST_SCOPE_EXIT_HAS_THIS_CONSUME_, \
- BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_HEAD(seq)(_)) _) ) \
-
-#define BOOST_SCOPE_EXIT_HAS_THIS_CONSUME_0 BOOST_SCOPE_EXIT_HAS_THIS_FALSE(
-#define BOOST_SCOPE_EXIT_HAS_THIS_CONSUME_1 BOOST_SCOPE_EXIT_HAS_THIS_TRUE(
-
-#define BOOST_SCOPE_EXIT_HAS_THIS_FALSE(x) 0
-#define BOOST_SCOPE_EXIT_HAS_THIS_TRUE(x) 1
-
-// Forwarding front-end to determine whether 'this' is the first
-// element of the sequence and adapt the invocation of the detail
-// accordingly. The dummy is passed to allow for an empty sequence.
-#define BOOST_SCOPE_EXIT_AUX_IMPL_FE(id, seq, ty) \
- BOOST_SCOPE_EXIT_AUX_IMPL_FE2(id, seq, ty, BOOST_SCOPE_EXIT_HAS_THIS(seq (dummy))) \
-
-#define BOOST_SCOPE_EXIT_AUX_IMPL_FE2(id, seq, ty, has_this) \
- BOOST_SCOPE_EXIT_AUX_IMPL(id, BOOST_PP_IF(has_this, BOOST_PP_SEQ_TAIL(seq),seq), \
- ty, BOOST_PP_IF(has_this, this,nothis) ) \
+#define BOOST_SCOPE_EXIT_AUX_TYPEDEF_TYPEOF_THIS(new_type) \
+ typedef BOOST_TYPEOF(this) new_type;
-//----end-'this-capture'-detection-and-selection-mechanics----
+#endif // typeof(this)
#ifdef BOOST_SCOPE_EXIT_AUX_TPL_WORKAROUND
-#define BOOST_SCOPE_EXIT_AUX_PARAMS_T_CTOR(id, seq, this)
+#define BOOST_SCOPE_EXIT_AUX_PARAMS_T_CTOR(id, seq)
#define BOOST_SCOPE_EXIT_AUX_PARAM_INIT(r, id, i, var) \
BOOST_PP_COMMA_IF(i) { BOOST_SCOPE_EXIT_AUX_DEREF(id,i,var) }
-#define BOOST_SCOPE_EXIT_AUX_PARAMS_INIT(id, seq, this) \
- = { BOOST_PP_CAT(BOOST_SCOPE_EXIT_REALTHIS_COMMA_IF_,this)(seq) \
- BOOST_PP_SEQ_FOR_EACH_I(BOOST_SCOPE_EXIT_AUX_PARAM_INIT, id, seq) };
+#define BOOST_SCOPE_EXIT_AUX_PARAMS_INIT(id, seq) \
+ = { BOOST_PP_SEQ_FOR_EACH_I(BOOST_SCOPE_EXIT_AUX_PARAM_INIT, id, seq) };
#else
@@ -309,23 +292,16 @@
#define BOOST_SCOPE_EXIT_AUX_MEMBER_INIT(r, id, i, var) BOOST_PP_COMMA_IF(i) \
BOOST_SCOPE_EXIT_AUX_PARAM(id,i,var) ( BOOST_PP_CAT(a,i) )
-#define BOOST_SCOPE_EXIT_AUX_PARAMS_T_CTOR(id, seq, this) \
+#define BOOST_SCOPE_EXIT_AUX_PARAMS_T_CTOR(id, seq) \
BOOST_SCOPE_EXIT_AUX_PARAMS_T(id)( \
- BOOST_PP_CAT(BOOST_SCOPE_EXIT_THISPARAM_COMMA_IF_,this)(id,seq) \
BOOST_PP_SEQ_FOR_EACH_I(BOOST_SCOPE_EXIT_AUX_CTOR_ARG, id, seq ) ) \
- BOOST_PP_CAT(BOOST_SCOPE_EXIT_THISINIT_BEGIN_PARAM_T_INITLIST_,this)(seq)\
- BOOST_PP_CAT(BOOST_SCOPE_EXIT_THISINIT_COMMA_IF_,this)(seq) \
- BOOST_PP_SEQ_FOR_EACH_I(BOOST_SCOPE_EXIT_AUX_MEMBER_INIT, id, seq) {}
+ : BOOST_PP_SEQ_FOR_EACH_I(BOOST_SCOPE_EXIT_AUX_MEMBER_INIT, id, seq) {}
#define BOOST_SCOPE_EXIT_AUX_PARAM_INIT(r, id, i, var) \
BOOST_PP_COMMA_IF(i) BOOST_SCOPE_EXIT_AUX_DEREF(id,i,var)
-#define BOOST_SCOPE_EXIT_AUX_PARAMS_INIT(id, seq, this) \
- BOOST_PP_IF(BOOST_PP_CAT(BOOST_SCOPE_EXIT_HASARGS_,this)(seq), \
- BOOST_PP_IDENTITY( \
- ( BOOST_PP_CAT(BOOST_SCOPE_EXIT_REALTHIS_COMMA_IF_,this)(seq) \
- BOOST_PP_SEQ_FOR_EACH_I(BOOST_SCOPE_EXIT_AUX_PARAM_INIT, id, seq) ) \
- ),BOOST_PP_EMPTY)(); \
+#define BOOST_SCOPE_EXIT_AUX_PARAMS_INIT(id, seq) \
+ ( BOOST_PP_SEQ_FOR_EACH_I(BOOST_SCOPE_EXIT_AUX_PARAM_INIT, id, seq) );
#endif
@@ -363,17 +339,14 @@
BOOST_PP_TUPLE_ELEM(2,0,idty), i, var) \
BOOST_SCOPE_EXIT_AUX_PARAM_T(BOOST_PP_TUPLE_ELEM(2,0,idty), i, var);
-
-#define BOOST_SCOPE_EXIT_AUX_IMPL(id, seq, ty, this) \
+#define BOOST_SCOPE_EXIT_AUX_IMPL(id, seq, ty) \
BOOST_PP_SEQ_FOR_EACH_I(BOOST_SCOPE_EXIT_AUX_TAG_DECL, id, seq) \
BOOST_PP_SEQ_FOR_EACH_I(BOOST_SCOPE_EXIT_AUX_CAPTURE_DECL, (id,ty), seq) \
- BOOST_PP_CAT(BOOST_SCOPE_EXIT_TYPEDEF_THISTYPE_,this)(id) \
struct BOOST_SCOPE_EXIT_AUX_PARAMS_T(id) { \
- BOOST_PP_CAT(BOOST_SCOPE_EXIT_DEFINE_THISMEMBER_,this)(id) \
BOOST_PP_SEQ_FOR_EACH_I(BOOST_SCOPE_EXIT_AUX_PARAM_DECL, (id,ty), seq) \
BOOST_PP_SEQ_FOR_EACH_I(BOOST_SCOPE_EXIT_AUX_MEMBER, id, seq) \
- BOOST_SCOPE_EXIT_AUX_PARAMS_T_CTOR(id, seq, this) \
- } BOOST_SCOPE_EXIT_AUX_PARAMS(id) BOOST_SCOPE_EXIT_AUX_PARAMS_INIT(id, seq, this)\
+ BOOST_SCOPE_EXIT_AUX_PARAMS_T_CTOR(id, seq) \
+ } BOOST_SCOPE_EXIT_AUX_PARAMS(id) BOOST_SCOPE_EXIT_AUX_PARAMS_INIT(id,seq) \
boost::scope_exit::aux::declared< boost::scope_exit::aux::resolve< \
sizeof(boost_scope_exit_args)>::cmp1<0>::cmp2 > boost_scope_exit_args; \
boost_scope_exit_args.value = &BOOST_SCOPE_EXIT_AUX_PARAMS(id); \
@@ -383,23 +356,18 @@
: boost_se_params_( \
(BOOST_SCOPE_EXIT_AUX_PARAMS_T(id)*)boost_se_params) \
{} \
- BOOST_PP_CAT(BOOST_SCOPE_EXIT_DEFINE_THIS_ACCESSOR_,this)(id) \
~BOOST_SCOPE_EXIT_AUX_GUARD_T(id)() { boost_se_body( \
BOOST_PP_SEQ_FOR_EACH_I(BOOST_SCOPE_EXIT_AUX_ARG, id, seq) ); } \
- void boost_se_body(BOOST_PP_SEQ_FOR_EACH_I( \
+ static void boost_se_body(BOOST_PP_SEQ_FOR_EACH_I( \
BOOST_SCOPE_EXIT_AUX_ARG_DECL, (id,ty), seq) )
#if defined(BOOST_MSVC)
-#ifndef BOOST_SCOPE_EXIT_DONT_DISABLE_C4003
-#pragma warning(disable:4003)
-#endif
-
#define BOOST_SCOPE_EXIT_END } BOOST_SCOPE_EXIT_AUX_GUARD(__COUNTER__) ( \
boost_scope_exit_args.value);
#define BOOST_SCOPE_EXIT(seq) \
- BOOST_SCOPE_EXIT_AUX_IMPL_FE(__COUNTER__, seq, BOOST_PP_EMPTY())
+ BOOST_SCOPE_EXIT_AUX_IMPL(__COUNTER__, seq, BOOST_PP_EMPTY())
#else
@@ -407,16 +375,17 @@
boost_scope_exit_args.value);
#define BOOST_SCOPE_EXIT(seq) \
- BOOST_SCOPE_EXIT_AUX_IMPL_FE(__LINE__, seq, BOOST_PP_EMPTY())
+ BOOST_SCOPE_EXIT_AUX_IMPL(__LINE__, seq, BOOST_PP_EMPTY())
#endif
#ifdef BOOST_SCOPE_EXIT_AUX_TPL_WORKAROUND
#define BOOST_SCOPE_EXIT_TPL(seq) \
- BOOST_SCOPE_EXIT_AUX_IMPL_FE(__LINE__, seq, typename)
+ BOOST_SCOPE_EXIT_AUX_IMPL(__LINE__, seq, typename)
#else
#define BOOST_SCOPE_EXIT_TPL(seq) BOOST_SCOPE_EXIT(seq)
#endif
-#endif // #ifndef FILE_boost_scope_exit_hpp_INCLUDED
+#endif // #if defined(BOOST_SCOPE_EXIT_AUX_CXX0X)
+#endif // #ifndef FILE_boost_scope_exit_hpp_INCLUDED
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