From 5e1cd63309657ea6f34fe3eac37b4c465d8ddad1 Mon Sep 17 00:00:00 2001 From: Amber Ehrlich Date: Sat, 3 Aug 2024 13:00:04 -0400 Subject: [PATCH] fix(coro): i must have been so eepy when i wrote this --- include/dpp/coro/awaitable.h | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/include/dpp/coro/awaitable.h b/include/dpp/coro/awaitable.h index 93c6c5b04a..9a6836b863 100644 --- a/include/dpp/coro/awaitable.h +++ b/include/dpp/coro/awaitable.h @@ -534,19 +534,7 @@ class basic_promise : public detail::promise::promise_base { } /** - * @brief Construct the result by copy, and resume any awaiter. - * - * @tparam Notify Whether to resume any awaiter or not. - * @throws dpp::logic_exception if the promise is not empty. - */ - template - requires (std::convertible_to) - void set_value(const U& v) { - emplace_value(v); - } - - /** - * @brief Construct the result by move, and resume any awaiter. + * @brief Construct the result by forwarding reference, and resume any awaiter. * * @tparam Notify Whether to resume any awaiter or not. * @throws dpp::logic_exception if the promise is not empty. @@ -554,11 +542,11 @@ class basic_promise : public detail::promise::promise_base { template requires (std::convertible_to) void set_value(U&& v) { - emplace_value(std::move(v)); + emplace_value(std::forward(v)); } /** - * @brief Construct the result by move, and resume any awaiter. + * @brief Construct a void result, and resume any awaiter. * * @tparam Notify Whether to resume any awaiter or not. * @throws dpp::logic_exception if the promise is not empty. @@ -605,19 +593,11 @@ class moveable_promise { } /** - * @copydoc basic_promise::set_value(const T&) - */ - template - void set_value(const U& v) requires (std::convertible_to) { - shared_state->template set_value(v); - } - - /** - * @copydoc basic_promise::set_value(T&&) + * @copydoc basic_promise::set_value(U&&) */ template void set_value(U&& v) requires (std::convertible_to) { - shared_state->template set_value(std::move(v)); + shared_state->template set_value(std::forward(v)); } /**