From 3333f01e3315f34d272cb5b2880f4075b28abe20 Mon Sep 17 00:00:00 2001 From: Naios Date: Fri, 19 Jun 2015 01:16:32 +0200 Subject: [PATCH] more work --- include/Continuable.h | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/include/Continuable.h b/include/Continuable.h index 633932a..1c84c97 100644 --- a/include/Continuable.h +++ b/include/Continuable.h @@ -58,10 +58,6 @@ namespace detail template struct unary_chainer; - // multiple_all_chainer forward declaration. - template - struct multiple_all_chainer; - // creates an empty callback. template struct create_empty_callback; @@ -99,9 +95,25 @@ namespace detail typedef typename result_t::CallbackFunction callback_t; }; - template - struct multiple_all_chainer<_CTy...> + // Void returning functionals + template + auto remove_void(_CTy&& functional) + -> typename std::enable_if::type>::value, + typename convert_void_to_continuable::type>::type>::type { + } + + // Non void returning functionals (route through) + template + auto remove_void(_CTy&& functional) + -> typename std::enable_if::type>::value, _CTy>::type + { + } + + template + struct multiple_all_chainer + { + }; template @@ -271,7 +283,7 @@ namespace detail } template - _ContinuableImpl& _all(_CTy&&...) + _ContinuableImpl& _wrap_all(_CTy&&...) { typedef multiple_all_chainer<_CTy...> type; @@ -281,10 +293,9 @@ namespace detail /// Placeholder template auto all(_CTy&&... functionals) - -> decltype((_ContinuableImpl*)(nullptr)-> - _all(box_continuable(std::forward<_CTy>(std::declval<_CTy>))...)) + -> _ContinuableImpl& { - return _all(box_continuable(std::forward<_CTy>(functionals))...); + return *this; } /// Placeholder