diff --git a/libs/async/include/psemek/async/future.hpp b/libs/async/include/psemek/async/future.hpp index dd545f0d..d80e992f 100644 --- a/libs/async/include/psemek/async/future.hpp +++ b/libs/async/include/psemek/async/future.hpp @@ -14,17 +14,6 @@ namespace psemek::async namespace detail { - template - struct get_return_type - { - using type = T &; - }; - - template <> - struct get_return_type - { - using type = void; - }; template struct task_value_container @@ -41,7 +30,7 @@ namespace psemek::async template struct then_function { - using type = util::function; + using type = util::function; }; template <> @@ -142,7 +131,7 @@ namespace psemek::async return has_value_unsafe(); } - detail::get_return_type::type get() + T get() { if (!state_) throw empty_future_error{}; @@ -154,7 +143,7 @@ namespace psemek::async if constexpr (std::is_same_v) return; else - return *(state_->value); + return std::move(*(state_->value)); } else std::rethrow_exception(state_->exception);