aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/threading/future/core/future-inl.h
diff options
context:
space:
mode:
authorAlexSm <alex@ydb.tech>2023-12-27 23:31:58 +0100
committerGitHub <noreply@github.com>2023-12-27 23:31:58 +0100
commitd67bfb4b4b7549081543e87a31bc6cb5c46ac973 (patch)
tree8674f2f1570877cb653e7ddcff37ba00288de15a /library/cpp/threading/future/core/future-inl.h
parent1f6bef05ed441c3aa2d565ac792b26cded704ac7 (diff)
downloadydb-d67bfb4b4b7549081543e87a31bc6cb5c46ac973.tar.gz
Import libs 4 (#758)
Diffstat (limited to 'library/cpp/threading/future/core/future-inl.h')
-rw-r--r--library/cpp/threading/future/core/future-inl.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/library/cpp/threading/future/core/future-inl.h b/library/cpp/threading/future/core/future-inl.h
index a98175af2d..db58b3156c 100644
--- a/library/cpp/threading/future/core/future-inl.h
+++ b/library/cpp/threading/future/core/future-inl.h
@@ -729,16 +729,16 @@ namespace NThreading {
}
template <typename R>
- inline TFuture<R> TFuture<void>::Return(const R& value) const {
- auto promise = NewPromise<R>();
- Subscribe([=](const TFuture<void>& future) mutable {
+ inline TFuture<std::remove_cvref_t<R>> TFuture<void>::Return(R&& value) const {
+ auto promise = NewPromise<std::remove_cvref_t<R>>();
+ Subscribe([promise, value = std::forward<R>(value)](const TFuture<void>& future) mutable {
try {
future.TryRethrow();
} catch (...) {
promise.SetException(std::current_exception());
return;
}
- promise.SetValue(value);
+ promise.SetValue(std::move(value));
});
return promise;
}