|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r48978 - in sandbox/thread_safe_signals/trunk/boost/signals2: . detail
From: fmhess_at_[hidden]
Date: 2008-09-26 16:11:42
Author: fmhess
Date: 2008-09-26 16:11:42 EDT (Fri, 26 Sep 2008)
New Revision: 48978
URL: http://svn.boost.org/trac/boost/changeset/48978
Log:
Pass arguments of slotN constructor which is bind syntactic sugar
as const references instead of as values.
Text files modified:
sandbox/thread_safe_signals/trunk/boost/signals2/detail/slot_template.hpp | 36 ++++++++++++++++++------------------
sandbox/thread_safe_signals/trunk/boost/signals2/slot.hpp | 6 +++---
2 files changed, 21 insertions(+), 21 deletions(-)
Modified: sandbox/thread_safe_signals/trunk/boost/signals2/detail/slot_template.hpp
==============================================================================
--- sandbox/thread_safe_signals/trunk/boost/signals2/detail/slot_template.hpp (original)
+++ sandbox/thread_safe_signals/trunk/boost/signals2/detail/slot_template.hpp 2008-09-26 16:11:42 EDT (Fri, 26 Sep 2008)
@@ -33,17 +33,17 @@
typedef SlotFunction slot_function_type;
typedef R result_type;
- // typedef Tn argn_type;
- #define BOOST_SIGNAL_MISC_STATEMENT(z, n, data) \
+// typedef Tn argn_type;
+#define BOOST_SIGNAL_MISC_STATEMENT(z, n, data) \
typedef BOOST_PP_CAT(T, BOOST_PP_INC(n)) BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(n)), _type);
BOOST_PP_REPEAT(BOOST_SIGNALS_NUM_ARGS, BOOST_SIGNAL_MISC_STATEMENT, ~)
- #undef BOOST_SIGNAL_MISC_STATEMENT
- #if BOOST_SIGNALS_NUM_ARGS == 1
+#undef BOOST_SIGNAL_MISC_STATEMENT
+#if BOOST_SIGNALS_NUM_ARGS == 1
typedef arg1_type argument_type;
- #elif BOOST_SIGNALS_NUM_ARGS == 2
+#elif BOOST_SIGNALS_NUM_ARGS == 2
typedef arg1_type first_argument_type;
typedef arg2_type second_argument_type;
- #endif
+#endif
BOOST_STATIC_CONSTANT(int, arity = BOOST_SIGNALS_NUM_ARGS);
template<typename F>
@@ -63,20 +63,20 @@
{
}
// bind syntactic sugar
- // ArgTypeN argN
- #define BOOST_SLOT_BINDING_ARG_DECL(z, n, data) \
- BOOST_PP_CAT(ArgType, n) BOOST_PP_CAT(arg, n)
- // template<typename Func, typename ArgType0, typename ArgType1, ..., typename ArgTypen-1> slotN(...
- #define BOOST_SLOT_BINDING_CONSTRUCTOR(z, n, data) \
- template<typename Func BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, typename ArgType)> \
- BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)(Func func BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM(n, BOOST_SLOT_BINDING_ARG_DECL, ~)): \
- _slot_function(bind(func BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, arg))) \
+// const ArgTypeN & argN
+#define BOOST_SLOT_BINDING_ARG_DECL(z, n, data) \
+ const BOOST_PP_CAT(ArgType, n) & BOOST_PP_CAT(arg, n)
+// template<typename Func, typename ArgType0, typename ArgType1, ..., typename ArgTypen-1> slotN(...
+#define BOOST_SLOT_BINDING_CONSTRUCTOR(z, n, data) \
+ template<typename Func, BOOST_PP_ENUM_PARAMS(n, typename ArgType)> \
+ BOOST_SLOT_CLASS_NAME(BOOST_SIGNALS_NUM_ARGS)(const Func &func, BOOST_PP_ENUM(n, BOOST_SLOT_BINDING_ARG_DECL, ~)): \
+ _slot_function(bind(func, BOOST_PP_ENUM_PARAMS(n, arg))) \
{}
- #define BOOST_SLOT_MAX_BINDING_ARGS 10
+#define BOOST_SLOT_MAX_BINDING_ARGS 10
BOOST_PP_REPEAT_FROM_TO(1, BOOST_SLOT_MAX_BINDING_ARGS, BOOST_SLOT_BINDING_CONSTRUCTOR, ~)
- #undef BOOST_SLOT_MAX_BINDING_ARGS
- #undef BOOST_SLOT_BINDING_ARG_DECL
- #undef BOOST_SLOT_BINDING_CONSTRUCTOR
+#undef BOOST_SLOT_MAX_BINDING_ARGS
+#undef BOOST_SLOT_BINDING_ARG_DECL
+#undef BOOST_SLOT_BINDING_CONSTRUCTOR
// invocation
R operator()(BOOST_SIGNAL_SIGNATURE_FULL_ARGS(BOOST_SIGNALS_NUM_ARGS))
{
Modified: sandbox/thread_safe_signals/trunk/boost/signals2/slot.hpp
==============================================================================
--- sandbox/thread_safe_signals/trunk/boost/signals2/slot.hpp (original)
+++ sandbox/thread_safe_signals/trunk/boost/signals2/slot.hpp 2008-09-26 16:11:42 EDT (Fri, 26 Sep 2008)
@@ -82,13 +82,13 @@
slot(const F& f): base_type(f)
{}
// bind syntactic sugar
-// AN aN
+// const AN & aN
#define BOOST_SLOT_BINDING_ARG_DECL(z, n, data) \
- BOOST_PP_CAT(A, n) BOOST_PP_CAT(a, n)
+ const BOOST_PP_CAT(A, n) & BOOST_PP_CAT(a, n)
// template<typename F, typename A0, typename A1, ..., typename An-1> slot(...
#define BOOST_SLOT_BINDING_CONSTRUCTOR(z, n, data) \
template<typename F, BOOST_PP_ENUM_PARAMS(n, typename A)> \
- slot(F f, BOOST_PP_ENUM(n, BOOST_SLOT_BINDING_ARG_DECL, ~)): \
+ slot(const F &f, BOOST_PP_ENUM(n, BOOST_SLOT_BINDING_ARG_DECL, ~)): \
base_type(f, BOOST_PP_ENUM_PARAMS(n, a)) \
{}
#define BOOST_SLOT_MAX_BINDING_ARGS 10
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