|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53392 - trunk/boost/signals2/detail
From: fmhess_at_[hidden]
Date: 2009-05-29 11:05:12
Author: fmhess
Date: 2009-05-29 11:05:10 EDT (Fri, 29 May 2009)
New Revision: 53392
URL: http://svn.boost.org/trac/boost/changeset/53392
Log:
Added inheritance of variadic signal/slot from std::unary_function or
std::binary_function as appropriate.
Text files modified:
trunk/boost/signals2/detail/preprocessed_arg_type.hpp | 12 ++++++++++++
trunk/boost/signals2/detail/signal_template.hpp | 3 ++-
trunk/boost/signals2/detail/signals_common_macros.hpp | 7 ++++++-
trunk/boost/signals2/detail/slot_template.hpp | 3 ++-
trunk/boost/signals2/detail/variadic_arg_type.hpp | 12 ++++++++++++
5 files changed, 34 insertions(+), 3 deletions(-)
Modified: trunk/boost/signals2/detail/preprocessed_arg_type.hpp
==============================================================================
--- trunk/boost/signals2/detail/preprocessed_arg_type.hpp (original)
+++ trunk/boost/signals2/detail/preprocessed_arg_type.hpp 2009-05-29 11:05:10 EDT (Fri, 29 May 2009)
@@ -19,4 +19,16 @@
#define BOOST_PP_FILENAME_1 <boost/signals2/detail/preprocessed_arg_type_template.hpp>
#include BOOST_PP_ITERATE()
+namespace boost
+{
+ namespace signals2
+ {
+ namespace detail
+ {
+ struct std_functional_base
+ {};
+ } // namespace detail
+ } // namespace signals2
+} // namespace boost
+
#endif // BOOST_SIGNALS2_PREPROCESSED_ARG_TYPE_HPP
Modified: trunk/boost/signals2/detail/signal_template.hpp
==============================================================================
--- trunk/boost/signals2/detail/signal_template.hpp (original)
+++ trunk/boost/signals2/detail/signal_template.hpp 2009-05-29 11:05:10 EDT (Fri, 29 May 2009)
@@ -512,7 +512,8 @@
template<BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION_DECL(BOOST_SIGNALS2_NUM_ARGS)>
class BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)
- BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION: public signal_base
+ BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION: public signal_base,
+ public detail::BOOST_SIGNALS2_STD_FUNCTIONAL_BASE(typename Combiner::result_type)
{
typedef detail::BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)
<BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION> impl_class;
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-05-29 11:05:10 EDT (Fri, 29 May 2009)
@@ -126,6 +126,8 @@
#define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION_DECL(arity) BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(arity)
#define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION
+#define BOOST_SIGNALS2_STD_FUNCTIONAL_BASE(result_type) std_functional_base
+
#define BOOST_SIGNALS2_PP_COMMA_IF(arity) BOOST_PP_COMMA_IF(arity)
#else // BOOST_NO_VARIADIC_TEMPLATES
@@ -134,6 +136,7 @@
#define BOOST_SIGNALS2_WEAK_SIGNAL_CLASS_NAME(arity) weak_signal
#define BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(arity) signal_impl
#define BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity) typename Signature
+#define BOOST_SIGNALS2_ARGS_TEMPLATE_INSTANTIATION(arity) Args...
#define BOOST_SIGNALS2_SIGNATURE_TEMPLATE_INSTANTIATION(arity) R (Args...)
#define BOOST_SIGNALS2_SIGNATURE_FUNCTION_TYPE(arity) R (Args...)
#define BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(arity) typename ... Args
@@ -147,7 +150,6 @@
#define BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(arity) Args ... args
#define BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(arity) args...
#define BOOST_SIGNALS2_PORTABLE_SIGNATURE(arity, Signature) Signature
-#define BOOST_SIGNALS2_EXT_SLOT_TEMPLATE_INSTANTIATION(arity) R (Args...)
#define BOOST_SIGNALS2_SLOT_CLASS_NAME(arity) slot
#define BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION_DECL(arity) \
@@ -191,6 +193,9 @@
ExtendedSlotFunction, \
Mutex>
+#define BOOST_SIGNALS2_STD_FUNCTIONAL_BASE(result_type) \
+ std_functional_base<result_type , Args...>
+
#define BOOST_SIGNALS2_PP_COMMA_IF(arity) ,
#endif // BOOST_NO_VARIADIC_TEMPLATES
Modified: trunk/boost/signals2/detail/slot_template.hpp
==============================================================================
--- trunk/boost/signals2/detail/slot_template.hpp (original)
+++ trunk/boost/signals2/detail/slot_template.hpp 2009-05-29 11:05:10 EDT (Fri, 29 May 2009)
@@ -31,7 +31,8 @@
template<BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION_DECL(BOOST_SIGNALS2_NUM_ARGS)>
class BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION
- : public slot_base
+ : public slot_base, public detail::BOOST_SIGNALS2_STD_FUNCTIONAL_BASE(R)
+
{
public:
template<BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS, Other), typename OtherSlotFunction>
Modified: trunk/boost/signals2/detail/variadic_arg_type.hpp
==============================================================================
--- trunk/boost/signals2/detail/variadic_arg_type.hpp (original)
+++ trunk/boost/signals2/detail/variadic_arg_type.hpp 2009-05-29 11:05:10 EDT (Fri, 29 May 2009)
@@ -10,6 +10,8 @@
#ifndef BOOST_SIGNALS2_DETAIL_VARIADIC_ARG_TYPE_HPP
#define BOOST_SIGNALS2_DETAIL_VARIADIC_ARG_TYPE_HPP
+#include <functional>
+
namespace boost
{
namespace signals2
@@ -29,6 +31,16 @@
public:
typedef typename variadic_arg_type<n - 1, Args...>::type type;
};
+
+ template <typename R, typename ... Args>
+ struct std_functional_base
+ {};
+ template <typename R, typename T1>
+ struct std_functional_base<R, T1>: public std::unary_function<T1, R>
+ {};
+ template <typename R, typename T1, typename T2>
+ struct std_functional_base<R, T1, T2>: public std::binary_function<T1, T2, R>
+ {};
} // namespace detail
} // namespace signals2
} // namespace boost
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