|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52372 - in trunk/boost/signals2: . detail
From: fmhess_at_[hidden]
Date: 2009-04-13 15:52:22
Author: fmhess
Date: 2009-04-13 15:52:21 EDT (Mon, 13 Apr 2009)
New Revision: 52372
URL: http://svn.boost.org/trac/boost/changeset/52372
Log:
Consolidated some redundant macros. Made BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS
settable by user.
Text files modified:
trunk/boost/signals2/detail/slot_template.hpp | 12 +++---------
trunk/boost/signals2/slot.hpp | 20 +++++++++++---------
2 files changed, 14 insertions(+), 18 deletions(-)
Modified: trunk/boost/signals2/detail/slot_template.hpp
==============================================================================
--- trunk/boost/signals2/detail/slot_template.hpp (original)
+++ trunk/boost/signals2/detail/slot_template.hpp 2009-04-13 15:52:21 EDT (Mon, 13 Apr 2009)
@@ -61,21 +61,15 @@
{
}
// bind syntactic sugar
-// const ArgTypeN & argN
-#define BOOST_SIGNALS2_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_SIGNALS2_SLOT_BINDING_CONSTRUCTOR(z, n, data) \
+#define BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTOR(z, n, data) \
template<typename Func, BOOST_PP_ENUM_PARAMS(n, typename ArgType)> \
BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)(const Func &func, BOOST_PP_ENUM(n, BOOST_SIGNALS2_SLOT_BINDING_ARG_DECL, ~)) \
{ \
init_slot_function(bind(func, BOOST_PP_ENUM_PARAMS(n, arg))); \
}
-#define BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS 10
- BOOST_PP_REPEAT_FROM_TO(1, BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS, BOOST_SIGNALS2_SLOT_BINDING_CONSTRUCTOR, ~)
-#undef BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS
-#undef BOOST_SIGNALS2_SLOT_BINDING_ARG_DECL
-#undef BOOST_SIGNALS2_SLOT_BINDING_CONSTRUCTOR
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS, BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTOR, ~)
+#undef BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTOR
// invocation
R operator()(BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(BOOST_SIGNALS2_NUM_ARGS))
{
Modified: trunk/boost/signals2/slot.hpp
==============================================================================
--- trunk/boost/signals2/slot.hpp (original)
+++ trunk/boost/signals2/slot.hpp 2009-04-13 15:52:21 EDT (Mon, 13 Apr 2009)
@@ -24,6 +24,14 @@
#include <boost/visit_each.hpp>
#include <boost/weak_ptr.hpp>
+
+#ifndef BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS
+#define BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS 10
+#endif
+// const ArgTypeN & argN
+#define BOOST_SIGNALS2_SLOT_BINDING_ARG_DECL(z, n, data) \
+ const BOOST_PP_CAT(ArgType, n) & BOOST_PP_CAT(arg, n)
+
namespace boost
{
namespace signals2
@@ -82,19 +90,13 @@
slot(const F& f): base_type(f)
{}
// bind syntactic sugar
-// const AN & aN
-#define BOOST_SIGNALS2_SLOT_BINDING_ARG_DECL(z, n, data) \
- const BOOST_PP_CAT(A, n) & BOOST_PP_CAT(a, n)
-// template<typename F, typename A0, typename A1, ..., typename An-1> slot(...
+// template<typename F, typename ArgType0, typename ArgType1, ..., typename ArgTypen-1> slot(...
#define BOOST_SIGNALS2_SLOT_BINDING_CONSTRUCTOR(z, n, data) \
- template<typename F, BOOST_PP_ENUM_PARAMS(n, typename A)> \
+ template<typename F, BOOST_PP_ENUM_PARAMS(n, typename ArgType)> \
slot(const F &f, BOOST_PP_ENUM(n, BOOST_SIGNALS2_SLOT_BINDING_ARG_DECL, ~)): \
- base_type(f, BOOST_PP_ENUM_PARAMS(n, a)) \
+ base_type(f, BOOST_PP_ENUM_PARAMS(n, arg)) \
{}
-#define BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS 10
BOOST_PP_REPEAT_FROM_TO(1, BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS, BOOST_SIGNALS2_SLOT_BINDING_CONSTRUCTOR, ~)
-#undef BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS
-#undef BOOST_SIGNALS2_SLOT_BINDING_ARG_DECL
#undef BOOST_SIGNALS2_SLOT_BINDING_CONSTRUCTOR
};
} // namespace signals2
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