diff --git a/fluent/Continuable.h b/fluent/Continuable.h index cd30026..e78be17 100644 --- a/fluent/Continuable.h +++ b/fluent/Continuable.h @@ -26,25 +26,33 @@ namespace detail } // detail -template -struct Continuable +template +struct ContinuableState { - typedef Callback&&> ForwardFunction; +}; + +template > +struct Continuable; + +template +struct Continuable, _State> +{ + typedef std::function&&)> ForwardFunction; // Function which expects a callback that is inserted from the Continuable // to chain everything together ForwardFunction _callback_insert; - Continuable<_ATy...>() { } + Continuable() { } template - Continuable<_ATy...>(_FTy&& callback_insert) + Continuable(_FTy&& callback_insert) : _callback_insert(std::forward<_FTy>(callback_insert)) { } template - Continuable<_ATy...> then(_CTy&&) + Continuable> then(_CTy&&) { - return Continuable<_ATy...>(); + return Continuable>(); } }; @@ -57,10 +65,10 @@ namespace detail struct ContinuableFactory<_FTy, _RTy, ::fu::identity&&>> { static auto CreateFrom(_FTy&& functional) - -> Continuable<_ATy...> + -> Continuable> { - return Continuable<_ATy...>( - typename Continuable<_ATy...>::ForwardFunction(std::forward<_FTy>(functional))); + return Continuable>( + typename Continuable>::ForwardFunction(std::forward<_FTy>(functional))); } }; diff --git a/test.cpp b/test.cpp index cb1b967..b37c010 100644 --- a/test.cpp +++ b/test.cpp @@ -19,7 +19,7 @@ enum SpellCastResult SPELL_FAILED_ALREADY_BEING_TAMED = 5 }; -Continuable CastSpell(int id) +Continuable> CastSpell(int id) { return make_continuable([=](Callback&& callback) {