@@ -534,31 +534,19 @@ class basic_promise : public detail::promise::promise_base<T> {
534
534
}
535
535
536
536
/* *
537
- * @brief Construct the result by copy, and resume any awaiter.
538
- *
539
- * @tparam Notify Whether to resume any awaiter or not.
540
- * @throws dpp::logic_exception if the promise is not empty.
541
- */
542
- template <bool Notify = true , typename U = T>
543
- requires (std::convertible_to<const U&, T>)
544
- void set_value (const U& v) {
545
- emplace_value<Notify>(v);
546
- }
547
-
548
- /* *
549
- * @brief Construct the result by move, and resume any awaiter.
537
+ * @brief Construct the result by forwarding reference, and resume any awaiter.
550
538
*
551
539
* @tparam Notify Whether to resume any awaiter or not.
552
540
* @throws dpp::logic_exception if the promise is not empty.
553
541
*/
554
542
template <bool Notify = true , typename U = T>
555
543
requires (std::convertible_to<U&&, T>)
556
544
void set_value (U&& v) {
557
- emplace_value<Notify>(std::move (v));
545
+ emplace_value<Notify>(std::forward<U> (v));
558
546
}
559
547
560
548
/* *
561
- * @brief Construct the result by move , and resume any awaiter.
549
+ * @brief Construct a void result , and resume any awaiter.
562
550
*
563
551
* @tparam Notify Whether to resume any awaiter or not.
564
552
* @throws dpp::logic_exception if the promise is not empty.
@@ -605,19 +593,11 @@ class moveable_promise {
605
593
}
606
594
607
595
/* *
608
- * @copydoc basic_promise<T>::set_value(const T&)
609
- */
610
- template <bool Notify = true , typename U = T>
611
- void set_value (const U& v) requires (std::convertible_to<const U&, T>) {
612
- shared_state->template set_value <Notify>(v);
613
- }
614
-
615
- /* *
616
- * @copydoc basic_promise<T>::set_value(T&&)
596
+ * @copydoc basic_promise<T>::set_value(U&&)
617
597
*/
618
598
template <bool Notify = true , typename U = T>
619
- void set_value (U&& v) requires (std::convertible_to<const U &, T>) {
620
- shared_state->template set_value <Notify>(std::move (v));
599
+ void set_value (U&& v) requires (std::convertible_to<U& &, T>) {
600
+ shared_state->template set_value <Notify>(std::forward<U> (v));
621
601
}
622
602
623
603
/* *
0 commit comments