diff --git a/include/continuable/detail/base.hpp b/include/continuable/detail/base.hpp index 3e42275..0b43e73 100644 --- a/include/continuable/detail/base.hpp +++ b/include/continuable/detail/base.hpp @@ -228,38 +228,28 @@ constexpr auto invoker_of(traits::identity>) { } // namespace decoration /// Invoke the callback immediately -template +template void packed_dispatch(types::this_thread_executor_tag, Invoker&& invoker, - Callback&& callback, NextCallback&& next_callback, Args&&... args) { // Invoke the callback with the decorated invoker immediately - std::forward(invoker)(std::forward(callback), - std::forward(next_callback), - std::forward(args)...); + std::forward(invoker)(std::forward(args)...); } /// Invoke the callback through the given executor -template -void packed_dispatch(Executor&& executor, Invoker&& invoker, - Callback&& callback, NextCallback&& next_callback, - Args&&... args) { +template +void packed_dispatch(Executor&& executor, Invoker&& invoker, Args&&... args) { // Create a worker object which when invoked calls the callback with the // the returned arguments. auto work = [ invoker = std::forward(invoker), - callback = std::forward(callback), - next_callback = std::forward(next_callback), args = std::make_tuple(std::forward(args)...) ]() mutable { traits::unpack(std::move(args), [&](auto&&... captured_args) { // Just use the packed dispatch method which dispatches the work on // the current thread. packed_dispatch(types::this_thread_executor_tag{}, std::move(invoker), - std::move(callback), std::move(next_callback), std::forward(captured_args)...); }); }; @@ -335,16 +325,14 @@ struct error_callback, Callback, Executor, /// The operator which is called when an error occurred void operator()(types::dispatch_error_tag /*tag*/, types::error_type error) { - // Just invoke the error handler, cancel the calling hierarchy then - auto invoker = [](Callback&& callback, NextCallback&&, - types::error_type&& error) { - callback(std::move(error)); + // Just invoke the error handler, cancel the calling hierarchy after + auto invoker = [](Callback&& callback, types::error_type&& error) { + std::move(callback)(std::move(error)); }; // Invoke the error handler packed_dispatch(std::move(executor_), std::move(invoker), - std::move(callback_), std::move(next_callback_), - std::move(error)); + std::move(callback_), std::move(error)); } /// Resolves the continuation with the given values diff --git a/test/playground/test-playground.cpp b/test/playground/test-playground.cpp index badf33e..b1b8196 100644 --- a/test/playground/test-playground.cpp +++ b/test/playground/test-playground.cpp @@ -69,13 +69,13 @@ int main(int, char**) { // ... }); - http_request2("github.com") + /*http_request2("github.com") .then([](std::string) { // ... }) .catching([](std::error_condition) { // ... - }); + });*/ return 0; }