Allow non copyable completion handlers in the asio example

This commit is contained in:
Denis Blank 2018-03-06 22:06:07 +01:00
parent 98aefb59d8
commit 715cece74c
2 changed files with 7 additions and 3 deletions

View File

@ -49,7 +49,7 @@ struct functional_io_service {
auto trough_post() noexcept { auto trough_post() noexcept {
return [&](auto&& work) mutable { return [&](auto&& work) mutable {
service_.post(std::forward<decltype(work)>(work)); asio::post(service_, std::forward<decltype(work)>(work));
}; };
} }

View File

@ -340,14 +340,17 @@ inline auto make_error_invoker(
std::integral_constant<handle_errors, handle_errors::plain>) noexcept { std::integral_constant<handle_errors, handle_errors::plain>) noexcept {
return [](auto&& callback, types::error_type&& error) { return [](auto&& callback, types::error_type&& error) {
// Errors are not partial invoked // Errors are not partial invoked
std::move(callback)(std::move(error)); // NOLINTNEXTLINE(hicpp-move-const-arg)
std::forward<decltype(callback)>(callback)(std::move(error));
}; };
} }
inline auto make_error_invoker( inline auto make_error_invoker(
std::integral_constant<handle_errors, handle_errors::forward>) noexcept { std::integral_constant<handle_errors, handle_errors::forward>) noexcept {
return [](auto&& callback, types::error_type&& error) { return [](auto&& callback, types::error_type&& error) {
// Errors are not partial invoked // Errors are not partial invoked
std::move(callback)(types::dispatch_error_tag{}, std::move(error)); std::forward<decltype(callback)>(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) { void set_exception(types::error_type error) {
// NOLINTNEXTLINE(hicpp-move-const-arg)
std::move (*this)(types::dispatch_error_tag{}, std::move(error)); std::move (*this)(types::dispatch_error_tag{}, std::move(error));
} }
}; };