From 257607627d2ddf80f5eb965bd914be336f4334de Mon Sep 17 00:00:00 2001 From: George Tokmaji Date: Sun, 23 Jul 2023 19:37:23 +0200 Subject: [PATCH] C4Task::Result: Fix support for move-only types --- src/C4Coroutine.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/C4Coroutine.h b/src/C4Coroutine.h index 8f960f477..218a3051e 100644 --- a/src/C4Coroutine.h +++ b/src/C4Coroutine.h @@ -57,7 +57,7 @@ template struct ValueWrapper { [[no_unique_address]] U Value; - U GetValue() const { return static_cast(Value); } + U &&GetValue() { return static_cast(Value); } }; template<> @@ -91,7 +91,7 @@ template class ResultBase { protected: - decltype(auto) GetValue() const + decltype(auto) GetValue() { return result.Wrapper.GetValue(); } @@ -203,7 +203,7 @@ class Result : protected ResultBase Result &operator=(const Result &) = delete; public: - decltype(auto) GetResult() const + decltype(auto) GetResult() { switch (resultState) {