From cc651dae4d68e2c765894ce9b7c2ab0a5cb0a4f8 Mon Sep 17 00:00:00 2001 From: Naios Date: Thu, 11 Jun 2015 00:04:43 +0200 Subject: [PATCH] make gcc & clang happy --- fluent++/Callback.h | 2 +- fluent++/Continuable.h | 20 ++++++++------------ test.cpp | 16 ++++++---------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/fluent++/Callback.h b/fluent++/Callback.h index 3d7525c..23f324b 100644 --- a/fluent++/Callback.h +++ b/fluent++/Callback.h @@ -89,7 +89,7 @@ inline shared_callback_of_t<_CTy> { return std::make_shared> (std::forward>(callback)); -} +}; /* Disabled due to clang errors template diff --git a/fluent++/Continuable.h b/fluent++/Continuable.h index 7589f72..52d2978 100644 --- a/fluent++/Continuable.h +++ b/fluent++/Continuable.h @@ -22,24 +22,20 @@ #include "Callback.h" template -struct Continuable; - -template -struct Continuable> +struct Continuable { - typedef std::function&&)> ForwardFunction; + typedef Callback&&> ForwardFunction; // Function which expects a callback that is inserted from the Continuable // to chain everything together ForwardFunction _callback_insert; -public: - Continuable>() { } - Continuable>(ForwardFunction&& callback_insert) + Continuable<_ATy...>() { } + Continuable<_ATy...>(ForwardFunction&& callback_insert) : _callback_insert(std::forward(callback_insert)) { } template - Continuable>& then(_CTy&&) + Continuable<_ATy...>& then(_CTy&&) { return *this; } @@ -54,9 +50,9 @@ namespace detail struct ContinuableFactory<_FTy, _RTy, ::fu::identity&&>> { static auto CreateFrom(_FTy&& functional) - -> Continuable> + -> Continuable<_ATy...> { - return Continuable>(std::forward<_FTy>(functional)); + return Continuable<_ATy...>(Callback&&>(std::forward<_FTy>(functional))); } }; @@ -76,7 +72,7 @@ namespace detail /// }); template inline auto make_continuable(_FTy&& functional) - -> decltype(typename detail::continuable_factory_t<_FTy>::CreateFrom(std::declval<_FTy>())) + -> decltype(detail::continuable_factory_t<_FTy>::CreateFrom(std::declval<_FTy>())) { return detail::continuable_factory_t<_FTy>::CreateFrom(std::forward<_FTy>(functional)); } diff --git a/test.cpp b/test.cpp index abfd71c..31d3cd2 100644 --- a/test.cpp +++ b/test.cpp @@ -16,11 +16,9 @@ enum SpellCastResult SPELL_FAILED_ALREADY_BEING_TAMED = 5 }; -// Continuable> -int CastSpell(int id) +Continuable CastSpell(int id) { - return 1; - make_continuable([=](Callback&& callback) + return make_continuable([=](Callback&& callback) { std::cout << "Cast " << id << std::endl; @@ -31,16 +29,14 @@ int CastSpell(int id) int main(int argc, char** argv) { - typedef Continuable> cont123; + typedef Continuable cont123; // typedef Continuable>::type myty1; // typedef Continuable, float>::type myty2; - // Continuable> - CastSpell(63362); - - Continuable> spell; - spell.then([](SpellCastResult result) + // Continuable> spell + CastSpell(63362) + .then([](SpellCastResult result) {