From 715cece74c0c4507c63c61f8915590edc3582a1a Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Tue, 6 Mar 2018 22:06:07 +0100 Subject: [PATCH] Allow non copyable completion handlers in the asio example --- examples/example-asio/example-asio.cpp | 2 +- include/continuable/detail/base.hpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/example-asio/example-asio.cpp b/examples/example-asio/example-asio.cpp index d559731..e5f8e5e 100644 --- a/examples/example-asio/example-asio.cpp +++ b/examples/example-asio/example-asio.cpp @@ -49,7 +49,7 @@ struct functional_io_service { auto trough_post() noexcept { return [&](auto&& work) mutable { - service_.post(std::forward(work)); + asio::post(service_, std::forward(work)); }; } diff --git a/include/continuable/detail/base.hpp b/include/continuable/detail/base.hpp index d26d860..4a54c95 100644 --- a/include/continuable/detail/base.hpp +++ b/include/continuable/detail/base.hpp @@ -340,14 +340,17 @@ inline auto make_error_invoker( std::integral_constant) noexcept { return [](auto&& callback, types::error_type&& error) { // Errors are not partial invoked - std::move(callback)(std::move(error)); + // NOLINTNEXTLINE(hicpp-move-const-arg) + std::forward(callback)(std::move(error)); }; } inline auto make_error_invoker( std::integral_constant) noexcept { return [](auto&& callback, types::error_type&& error) { // Errors are not partial invoked - std::move(callback)(types::dispatch_error_tag{}, std::move(error)); + std::forward(callback)( + types::dispatch_error_tag{}, + std::move(error)); // NOLINT(hicpp-move-const-arg) }; } @@ -465,6 +468,7 @@ struct final_callback : util::non_copyable { } void set_exception(types::error_type error) { + // NOLINTNEXTLINE(hicpp-move-const-arg) std::move (*this)(types::dispatch_error_tag{}, std::move(error)); } };