diff --git a/include/continuable/detail/base.hpp b/include/continuable/detail/base.hpp index 71f1cd6..d26d860 100644 --- a/include/continuable/detail/base.hpp +++ b/include/continuable/detail/base.hpp @@ -392,9 +392,8 @@ struct callback_base, HandleResults, proto::error_handler_base< HandleErrors, callback_base, HandleResults, - HandleErrors, Callback, Executor, NextCallback>> { - - using CallbackT = Callback; + HandleErrors, Callback, Executor, NextCallback>>, + util::non_copyable { Callback callback_; Executor executor_; @@ -445,16 +444,12 @@ auto make_callback(Callback&& callback, Executor&& executor, /// Once this was a workaround for GCC bug: /// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64095 -struct final_callback { +struct final_callback : util::non_copyable { template void operator()(Args... /*args*/) && { } - template - void set_value(Args... /*args*/) { - } - - void set_exception(types::error_type error) { + void operator()(types::dispatch_error_tag, types::error_type error) && { (void)error; #ifndef CONTINUABLE_WITH_UNHANDLED_ERRORS // There were unhandled errors inside the asynchronous call chain! @@ -463,6 +458,15 @@ struct final_callback { util::trap(); #endif // CONTINUABLE_WITH_UNHANDLED_ERRORS } + + template + void set_value(Args... args) { + std::move (*this)(std::forward(args)...); + } + + void set_exception(types::error_type error) { + std::move (*this)(types::dispatch_error_tag{}, std::move(error)); + } }; } // namespace callbacks