diff --git a/include/Continuable.h b/include/Continuable.h index ba29240..560feba 100644 --- a/include/Continuable.h +++ b/include/Continuable.h @@ -51,6 +51,9 @@ namespace detail } }; + template + struct unary_chainer_t; + /// Functional traits forward declaration. template struct functional_traits; @@ -90,21 +93,6 @@ private: } } - /// Helper trait for unary chains like `Continuable::then` - template - struct unary_chainer_t - { - // Corrected user given functional - typedef decltype(detail::functional_traits<_ATy...>:: - correct(std::declval::type>())) corrected_t; - - typedef fu::return_type_of_t continuable_t; - - typedef fu::argument_type_of_t arguments_t; - - typedef typename continuable_t::CallbackFunction callback_t; - }; - public: /// Deleted copy construct Continuable(Continuable const&) = delete; @@ -158,10 +146,10 @@ public: /// Waits for this continuable and invokes the given callback. template auto then(_CTy&& functional) - -> typename unary_chainer_t<_CTy>::continuable_t + -> typename detail::unary_chainer_t<_CTy, _ATy...>::continuable_t { static_assert(std::is_same, - typename unary_chainer_t<_CTy>::arguments_t>::value, + typename detail::unary_chainer_t<_CTy, _ATy...>::arguments_t>::value, "Given function signature isn't correct, for now it must match strictly!"); // Transfer the insert function to the local scope. @@ -171,8 +159,8 @@ public: auto&& corrected = detail::functional_traits<_ATy...>:: correct(std::forward<_CTy>(functional)); - return typename unary_chainer_t<_CTy>::continuable_t( - [corrected, callback](typename unary_chainer_t<_CTy>::callback_t&& call_next) + return typename detail::unary_chainer_t<_CTy, _ATy...>::continuable_t( + [corrected, callback](typename detail::unary_chainer_t<_CTy, _ATy...>::callback_t&& call_next) { callback([corrected, call_next](_ATy&&... args) mutable { @@ -289,6 +277,22 @@ inline auto make_continuable() namespace detail { + + /// Helper trait for unary chains like `Continuable::then` + template + struct unary_chainer_t + { + // Corrected user given functional + typedef decltype(detail::functional_traits<_ATy...>:: + correct(std::declval::type>())) corrected_t; + + typedef fu::return_type_of_t continuable_t; + + typedef fu::argument_type_of_t arguments_t; + + typedef typename continuable_t::CallbackFunction callback_t; + }; + template struct concat_identities;