diff --git a/include/boost/asio/experimental/impl/promise.hpp b/include/boost/asio/experimental/impl/promise.hpp index 0eb0f6b6fc..fb3d0fdec3 100644 --- a/include/boost/asio/experimental/impl/promise.hpp +++ b/include/boost/asio/experimental/impl/promise.hpp @@ -64,12 +64,14 @@ struct promise_impl Allocator allocator; Executor executor; - template - void apply_impl(Func f, boost::asio::detail::index_sequence) - { - auto& result_type = *reinterpret_cast(&result); - f(std::get(std::move(result_type))...); - } + template +void apply_impl(Func f, boost::asio::detail::index_sequence) +{ + auto& result_type = *reinterpret_cast(&result); + f(std::get(result_type)...); // Remove std::move() +} + + using allocator_type = Allocator; allocator_type get_allocator() {return allocator;} @@ -231,19 +233,20 @@ struct promise_handler return promise{impl_}; } - void operator()(std::remove_reference_t... ts) - { - assert(impl_); +void operator()(std::remove_reference_t... ts) +{ + assert(impl_); - using result_type = typename promise_impl< - void(Ts...), allocator_type, executor_type>::result_type ; + using result_type = typename promise_impl< + void(Ts...), allocator_type, executor_type>::result_type ; - new (&impl_->result) result_type(std::move(ts)...); - impl_->done = true; + new (&impl_->result) result_type(ts...); // Remove std::move() - if (impl_->completion) - impl_->complete_with_result(); - } + impl_->done = true; + + if (impl_->completion) + impl_->complete_with_result(); +} }; } // namespace detail