This commit is contained in:
Naios 2015-07-02 20:55:44 +02:00
parent 4a36632269
commit 3f7ad6f580
2 changed files with 7 additions and 14 deletions

View File

@ -509,11 +509,8 @@ namespace detail
std::mutex lock; std::mutex lock;
template <typename, std::size_t> template <std::size_t Offset>
struct result_store_sequencer; struct result_store_sequencer
template <std::size_t... Sequence, std::size_t Offset>
struct result_store_sequencer<fu::sequence<Sequence...>, Offset>
{ {
template<std::size_t Position, typename Tuple, typename Current> template<std::size_t Position, typename Tuple, typename Current>
inline static void partial_set(Tuple& result, Current&& current) inline static void partial_set(Tuple& result, Current&& current)
@ -552,10 +549,8 @@ namespace detail
template<std::size_t Offset, typename... Args> template<std::size_t Offset, typename... Args>
void store(Args&&... args) void store(Args&&... args)
{ {
result_store_sequencer< result_store_sequencer<Offset>::
fu::sequence_of_t<sizeof...(Args)>, store(result, std::forward<Args>(args)...);
Offset
>::store(result, std::forward<Args>(args)...);
// TODO Improve the lock here // TODO Improve the lock here
std::lock_guard<std::mutex> guard(lock); std::lock_guard<std::mutex> guard(lock);
@ -666,7 +661,7 @@ namespace detail
// TODO Use the stack instead of heap variables. // TODO Use the stack instead of heap variables.
auto shared_args = auto shared_args =
std::make_shared<std::tuple<_ATy...>>( std::make_shared<std::tuple<_ATy...>>(
std::make_tuple(std::forward<_ATy>(args)...)); std::forward_as_tuple(std::forward<_ATy>(args)...));
// Fake continuable which wraps all continuables together // Fake continuable which wraps all continuables together
return make_continuable([=](Callback<_RTy...>&& callback) mutable return make_continuable([=](Callback<_RTy...>&& callback) mutable

View File

@ -415,15 +415,13 @@ int main(int /*argc*/, char** /*argv*/)
[] { [] {
return make_continuable([](Callback<bool, bool, double, std::string>&& callback) return make_continuable([](Callback<bool, bool, double, std::string>&& callback)
{ {
callback(true, false, 0.3f, std::string("huhu all work is done!")); callback(true, false, 0.3f, std::string("oh, all work is done!"));
}); });
}, },
TrivialPromise()) TrivialPromise())
.then([](SpellCastResult r0, SpellCastResult r1, bool r2, bool r3, double r4, std::string message) .then([](SpellCastResult r0, SpellCastResult r1, bool r2, bool r3, double r4, std::string message)
{ {
return TrivialPromise("Lets see... ").then(Log(message));
return Log(message);
}) })
.then([] .then([]
{ {