Skip to content

Commit

Permalink
fix(coro): i must have been so eepy when i wrote this
Browse files Browse the repository at this point in the history
  • Loading branch information
Mishura4 committed Aug 3, 2024
1 parent 4a9bc5f commit 5e1cd63
Showing 1 changed file with 5 additions and 25 deletions.
30 changes: 5 additions & 25 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<U&&, T>) {
shared_state->template set_value<Notify>(std::move(v));
shared_state->template set_value<Notify>(std::forward<U>(v));
}

/**
Expand Down

0 comments on commit 5e1cd63

Please sign in to comment.