From 3501d42a8090b5f1abbca9f55cd81d5ebe6a5ffb Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Thu, 2 Jul 2015 20:42:37 +0200 Subject: [PATCH] first working example! --- include/Continuable.h | 2 +- test.cpp | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/Continuable.h b/include/Continuable.h index 1ced299..9970283 100644 --- a/include/Continuable.h +++ b/include/Continuable.h @@ -565,7 +565,7 @@ namespace detail // If all partitions have completed invoke the final callback. if (--partitions_left == 0) { - + fu::invoke_from_tuple(callback, result); } } } diff --git a/test.cpp b/test.cpp index 74d568e..0d9a1ac 100644 --- a/test.cpp +++ b/test.cpp @@ -73,10 +73,7 @@ Continuable CastSpellPromise(int id) // Void instant returning continuable promise for testing purposes Continuable<> TrivialPromise(std::string const& msg = "") { - return Log(msg).then(make_continuable([=](Callback<>&& callback) - { - callback(); - })); + return Log(msg); } Continuable Validate() @@ -416,21 +413,22 @@ int main(int /*argc*/, char** /*argv*/) return CastSpellPromise(20); }, [] { - return make_continuable([](Callback&& callback) + return make_continuable([](Callback&& callback) { - callback(true, false); + callback(true, false, 0.3f, std::string("huhu all work is done!")); }); }, TrivialPromise()) - .then([](SpellCastResult, SpellCastResult, bool, bool) + .then([](SpellCastResult r0, SpellCastResult r1, bool r2, bool r3, double r4, std::string message) { - + + + return Log(message); }) .then([] { - }) - .then(TrivialPromise()); + }); std::cout << "ok" << std::endl; return 0;