first working example!

This commit is contained in:
Denis Blank 2015-07-02 20:42:37 +02:00 committed by Naios
parent e82a2be267
commit 3501d42a80
2 changed files with 9 additions and 11 deletions

View File

@ -565,7 +565,7 @@ namespace detail
// If all partitions have completed invoke the final callback. // If all partitions have completed invoke the final callback.
if (--partitions_left == 0) if (--partitions_left == 0)
{ {
fu::invoke_from_tuple(callback, result);
} }
} }
} }

View File

@ -73,10 +73,7 @@ Continuable<SpellCastResult> CastSpellPromise(int id)
// Void instant returning continuable promise for testing purposes // Void instant returning continuable promise for testing purposes
Continuable<> TrivialPromise(std::string const& msg = "") Continuable<> TrivialPromise(std::string const& msg = "")
{ {
return Log(msg).then(make_continuable([=](Callback<>&& callback) return Log(msg);
{
callback();
}));
} }
Continuable<bool> Validate() Continuable<bool> Validate()
@ -416,21 +413,22 @@ int main(int /*argc*/, char** /*argv*/)
return CastSpellPromise(20); return CastSpellPromise(20);
}, },
[] { [] {
return make_continuable([](Callback<bool, bool>&& callback) return make_continuable([](Callback<bool, bool, double, std::string>&& callback)
{ {
callback(true, false); callback(true, false, 0.3f, std::string("huhu all work is done!"));
}); });
}, },
TrivialPromise()) 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([]
{ {
}) });
.then(TrivialPromise());
std::cout << "ok" << std::endl; std::cout << "ok" << std::endl;
return 0; return 0;