Skip to content

Commit

Permalink
fix(coro): fix an oopsie (#1219)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mishura4 authored Aug 4, 2024
1 parent 19e24f3 commit aaeed33
Showing 1 changed file with 6 additions and 26 deletions.
32 changes: 6 additions & 26 deletions include/dpp/coro/awaitable.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,31 +534,19 @@ class basic_promise : public detail::promise::promise_base<T> {
}

/**
* @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 <bool Notify = true, typename U = T>
requires (std::convertible_to<const U&, T>)
void set_value(const U& v) {
emplace_value<Notify>(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.
*/
template <bool Notify = true, typename U = T>
requires (std::convertible_to<U&&, T>)
void set_value(U&& v) {
emplace_value<Notify>(std::move(v));
emplace_value<Notify>(std::forward<U>(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.
Expand Down Expand Up @@ -605,19 +593,11 @@ class moveable_promise {
}

/**
* @copydoc basic_promise<T>::set_value(const T&)
*/
template <bool Notify = true, typename U = T>
void set_value(const U& v) requires (std::convertible_to<const U&, T>) {
shared_state->template set_value<Notify>(v);
}

/**
* @copydoc basic_promise<T>::set_value(T&&)
* @copydoc basic_promise<T>::set_value(U&&)
*/
template <bool Notify = true, typename U = T>
void set_value(U&& v) requires (std::convertible_to<const U&, T>) {
shared_state->template set_value<Notify>(std::move(v));
void set_value(U&& v) requires (std::convertible_to<U&&, T>) {
shared_state->template set_value<Notify>(std::forward<U>(v));
}

/**
Expand Down

0 comments on commit aaeed33

Please sign in to comment.