From 2268a7e4aaed4c356df7723262c8c895554c7af9 Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Fri, 19 Apr 2024 11:09:56 +0800 Subject: [PATCH] feat as const function for promise --- src/sled/futures/internal/promise.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sled/futures/internal/promise.h b/src/sled/futures/internal/promise.h index aa1ad14..b586569 100644 --- a/src/sled/futures/internal/promise.h +++ b/src/sled/futures/internal/promise.h @@ -29,14 +29,14 @@ public: bool IsFilled() const noexcept { return future_.IsCompleted(); } - void Failure(const FailureT &reason) { return future_.FillFailure(reason); } + void Failure(const FailureT &reason) const noexcept { return future_.FillFailure(reason); } - void Success(const T &value) { return future_.FillSuccess(value); } + void Success(const T &value) const noexcept { return future_.FillSuccess(value); } - void Success(T &&value) { return future_.FillSuccess(std::move(value)); } + void Success(T &&value) const noexcept { return future_.FillSuccess(std::move(value)); } private: - Future future_ = Future::Create(); + mutable Future future_ = Future::Create(); }; }// namespace sled