From f1d9dd94c8843a915e4e551dc7cdd63f9d2a4b29 Mon Sep 17 00:00:00 2001 From: Naios Date: Mon, 6 Jul 2015 14:46:15 +0200 Subject: [PATCH] some comments --- include/Continuable.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/include/Continuable.h b/include/Continuable.h index 3cb5dad..21865f9 100644 --- a/include/Continuable.h +++ b/include/Continuable.h @@ -542,7 +542,7 @@ namespace detail template inline static void partial_set(Tuple& result, Current&& current) { - // Store the callback result in the tuple + // Store a single callback result in the tuple std::get(result) = std::forward(current); } @@ -569,13 +569,17 @@ namespace detail } template - static void invoke( - std::shared_ptr, fu::identity<_RTy...>, fu::identity<_PTy...>>> storage, - Continuable&& continuable) + static void invoke(std::shared_ptr, fu::identity<_RTy...>, fu::identity<_PTy...>>> storage, + Continuable&& continuable) { + // Invoke the continuable continuable.invoke([storage](Args&&... args) { + // Route its result to the cache. store(storage->result, std::forward(args)...); + + // Try to invoke the final callback. storage->try_invoke(); }); } @@ -624,8 +628,10 @@ namespace detail template inline static void invoke(shared_result_t storage, Arguments&& args, _CTy&& current, Rest&&... rest) { + // Invoke the current continuable... invoke(storage, std::forward(args), std::forward<_CTy>(current)); + // And continue with the next distributor::invoke(storage, std::forward(args), std::forward(rest)...); } }; @@ -638,7 +644,8 @@ namespace detail { template inline static void invoke(shared_result_t result, Arguments&& arguments, TupleFunctional&& functional) - { + { + // Invoke the distributor which invokes all given continuables. distributor<_PTy...>::invoke( result, std::forward(arguments),