Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53554 - trunk/boost/signals2/detail
From: fmhess_at_[hidden]
Date: 2009-06-01 15:42:04


Author: fmhess
Date: 2009-06-01 15:42:04 EDT (Mon, 01 Jun 2009)
New Revision: 53554
URL: http://svn.boost.org/trac/boost/changeset/53554

Log:
Work around overload resolution failures on gcc 3.4

Text files modified:
   trunk/boost/signals2/detail/signal_template.hpp | 85 +++++++++++++++++++--------------------
   trunk/boost/signals2/detail/signals_common_macros.hpp | 3 +
   2 files changed, 45 insertions(+), 43 deletions(-)

Modified: trunk/boost/signals2/detail/signal_template.hpp
==============================================================================
--- trunk/boost/signals2/detail/signal_template.hpp (original)
+++ trunk/boost/signals2/detail/signal_template.hpp 2009-06-01 15:42:04 EDT (Mon, 01 Jun 2009)
@@ -30,6 +30,40 @@
   {
     namespace detail
     {
+ // helper for bound_extended_slot_function that handles specialization for void return
+ template<typename R>
+ class BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(BOOST_SIGNALS2_NUM_ARGS)
+ {
+ public:
+ typedef R result_type;
+ template<typename ExtendedSlotFunction BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
+ BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)>
+ result_type operator()(ExtendedSlotFunction &func, const connection &conn
+ BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
+ BOOST_SIGNALS2_FULL_REF_ARGS(BOOST_SIGNALS2_NUM_ARGS)) const
+ {
+ return func(conn BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
+ BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS));
+ }
+ };
+#ifdef BOOST_NO_VOID_RETURNS
+ template<>
+ class BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(BOOST_SIGNALS2_NUM_ARGS)<void>
+ {
+ public:
+ typedef result_type_wrapper<void>::type result_type;
+ template<typename ExtendedSlotFunction BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
+ BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)>
+ result_type operator()(ExtendedSlotFunction &func, const connection &conn
+ BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
+ BOOST_SIGNALS2_FULL_REF_ARGS(BOOST_SIGNALS2_NUM_ARGS)) const
+ {
+ func(conn BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
+ BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS));
+ return result_type();
+ }
+ };
+#endif
 // wrapper around an signalN::extended_slot_function which binds the
 // connection argument so it looks like a normal
 // signalN::slot_function
@@ -52,9 +86,10 @@
 #endif // BOOST_SIGNALS2_NUM_ARGS > 0
           result_type operator()(BOOST_SIGNALS2_FULL_REF_ARGS(BOOST_SIGNALS2_NUM_ARGS))
         {
- typename ExtendedSlotFunction::result_type *resolver = 0;
- return m_invoke(resolver BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
- BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS));
+ return BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(BOOST_SIGNALS2_NUM_ARGS)
+ <typename ExtendedSlotFunction::result_type>()
+ (_fun, *_connection BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
+ BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS));
         }
         // const overload
 #if BOOST_SIGNALS2_NUM_ARGS > 0
@@ -62,9 +97,10 @@
 #endif // BOOST_SIGNALS2_NUM_ARGS > 0
           result_type operator()(BOOST_SIGNALS2_FULL_REF_ARGS(BOOST_SIGNALS2_NUM_ARGS)) const
         {
- typename ExtendedSlotFunction::result_type *resolver = 0;
- return m_invoke(resolver BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
- BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS));
+ return BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(BOOST_SIGNALS2_NUM_ARGS)
+ <typename ExtendedSlotFunction::result_type>()
+ (_fun, *_connection BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
+ BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS));
         }
         template<typename T>
           bool operator==(const T &other) const
@@ -74,43 +110,6 @@
       private:
         BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_N(BOOST_SIGNALS2_NUM_ARGS)()
         {}
- template<typename T BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
- BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)>
- result_type m_invoke(T* BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
- BOOST_SIGNALS2_FULL_REF_ARGS(BOOST_SIGNALS2_NUM_ARGS))
- {
- return _fun(*_connection BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
- BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS));
- }
-#if BOOST_SIGNALS2_NUM_ARGS > 0
- template<BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)>
-#endif // BOOST_SIGNALS2_NUM_ARGS > 0
- result_type m_invoke(void* BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
- BOOST_SIGNALS2_FULL_REF_ARGS(BOOST_SIGNALS2_NUM_ARGS))
- {
- _fun(*_connection BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
- BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS));
- return result_type();
- }
- // const overloads
- template<typename T BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
- BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)>
- result_type m_invoke(T* BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
- BOOST_SIGNALS2_FULL_REF_ARGS(BOOST_SIGNALS2_NUM_ARGS)) const
- {
- return _fun(*_connection BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
- BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS));
- }
-#if BOOST_SIGNALS2_NUM_ARGS > 0
- template<BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)>
-#endif // BOOST_SIGNALS2_NUM_ARGS > 0
- result_type m_invoke(void* BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
- BOOST_SIGNALS2_FULL_REF_ARGS(BOOST_SIGNALS2_NUM_ARGS)) const
- {
- _fun(*_connection BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS)
- BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS));
- return result_type();
- }
 
         ExtendedSlotFunction _fun;
         boost::shared_ptr<connection> _connection;

Modified: trunk/boost/signals2/detail/signals_common_macros.hpp
==============================================================================
--- trunk/boost/signals2/detail/signals_common_macros.hpp (original)
+++ trunk/boost/signals2/detail/signals_common_macros.hpp 2009-06-01 15:42:04 EDT (Mon, 01 Jun 2009)
@@ -77,6 +77,8 @@
   extended_slot_function_type>
 // bound_extended_slot_functionN
 #define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_N(arity) BOOST_PP_CAT(bound_extended_slot_function, arity)
+// bound_extended_slot_function_helperN
+#define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(arity) BOOST_PP_CAT(bound_extended_slot_function_invoker, arity)
 // typename function_traits<Signature>::argn_type
 #define BOOST_SIGNALS2_SIGNATURE_TO_ARGN_TYPE(z, n, Signature) \
   BOOST_PP_CAT(BOOST_PP_CAT(typename function_traits<Signature>::arg, BOOST_PP_INC(n)), _type)
@@ -144,6 +146,7 @@
 #define BOOST_SIGNALS2_SLOT_CLASS_NAME(arity) slot
 #define BOOST_SIGNALS2_EXTENDED_SLOT_TYPE(arity) slot<R (const connection &, Args...), extended_slot_function_type>
 #define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_N(arity) bound_extended_slot_function
+#define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(arity) bound_extended_slot_function_invoker
 #define BOOST_SIGNALS2_FUNCTION_N_DECL(arity) boost::function<Signature>
 #define BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_DECL(arity, prefix) typename prefixSignature
 #define BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_INSTANTIATION(arity, prefix) prefixSignature


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