summaryrefslogtreecommitdiff
path: root/boost/signals2/detail/variadic_slot_invoker.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/signals2/detail/variadic_slot_invoker.hpp')
-rw-r--r--boost/signals2/detail/variadic_slot_invoker.hpp33
1 files changed, 13 insertions, 20 deletions
diff --git a/boost/signals2/detail/variadic_slot_invoker.hpp b/boost/signals2/detail/variadic_slot_invoker.hpp
index cab331eb1c..c115a63df5 100644
--- a/boost/signals2/detail/variadic_slot_invoker.hpp
+++ b/boost/signals2/detail/variadic_slot_invoker.hpp
@@ -77,17 +77,20 @@ namespace boost
R operator()(Func &func, BOOST_SIGNALS2_TUPLE<Args...> args, mpl::size_t<N>) const
{
typedef typename make_unsigned_meta_array<N>::type indices_type;
- typename Func::result_type *resolver = 0;
- return m_invoke(resolver, func, indices_type(), args);
+ return m_invoke<Func>(func, indices_type(), args);
}
private:
- template<typename T, typename Func, unsigned ... indices, typename ... Args>
- R m_invoke(T *, Func &func, unsigned_meta_array<indices...>, BOOST_SIGNALS2_TUPLE<Args...> args) const
+ template<typename Func, unsigned ... indices, typename ... Args>
+ R m_invoke(Func &func, unsigned_meta_array<indices...>, BOOST_SIGNALS2_TUPLE<Args...> args,
+ typename boost::disable_if<boost::is_void<typename Func::result_type> >::type * = 0
+ ) const
{
return func(BOOST_SIGNALS2_GET<indices>(args)...);
}
template<typename Func, unsigned ... indices, typename ... Args>
- R m_invoke(void *, Func &func, unsigned_meta_array<indices...>, BOOST_SIGNALS2_TUPLE<Args...> args) const
+ R m_invoke(Func &func, unsigned_meta_array<indices...>, BOOST_SIGNALS2_TUPLE<Args...> args,
+ typename boost::enable_if<boost::is_void<typename Func::result_type> >::type * = 0
+ ) const
{
func(BOOST_SIGNALS2_GET<indices>(args)...);
return R();
@@ -97,7 +100,9 @@ namespace boost
// only exists to quiet some unused parameter warnings
// on certain compilers (some versions of gcc and msvc)
template<typename Func>
- R m_invoke(void *, Func &func, unsigned_meta_array<>, BOOST_SIGNALS2_TUPLE<>) const
+ R m_invoke(Func &func, unsigned_meta_array<>, BOOST_SIGNALS2_TUPLE<>,
+ typename boost::enable_if<boost::is_void<typename Func::result_type> >::type * = 0
+ ) const
{
func();
return R();
@@ -115,22 +120,10 @@ namespace boost
template<typename ConnectionBodyType>
result_type operator ()(const ConnectionBodyType &connectionBody) const
{
- result_type *resolver = 0;
- return m_invoke(connectionBody,
- resolver);
+ return call_with_tuple_args<result_type>()(connectionBody->slot().slot_function(),
+ _args, mpl::size_t<sizeof...(Args)>());
}
private:
- template<typename ConnectionBodyType>
- result_type m_invoke(const ConnectionBodyType &connectionBody,
- const void_type *) const
- {
- return call_with_tuple_args<result_type>()(connectionBody->slot.slot_function(), _args, mpl::size_t<sizeof...(Args)>());
- }
- template<typename ConnectionBodyType>
- result_type m_invoke(const ConnectionBodyType &connectionBody, ...) const
- {
- return call_with_tuple_args<result_type>()(connectionBody->slot.slot_function(), _args, mpl::size_t<sizeof...(Args)>());
- }
BOOST_SIGNALS2_TUPLE<Args& ...> _args;
};
} // namespace detail