From 537924a8d0ae87ba9f2cb9938f5662d0ec130982 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Sat, 10 Dec 2022 15:29:20 +0330 Subject: [PATCH] AK: Let ErrorOr expose its result/error types `ErrorOr::ResultType` can now refer to `T`. --- AK/Error.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AK/Error.h b/AK/Error.h index 8b3fcdd5589..007bd8a22a0 100644 --- a/AK/Error.h +++ b/AK/Error.h @@ -72,9 +72,12 @@ private: bool m_syscall { false }; }; -template +template class [[nodiscard]] ErrorOr { public: + using ResultType = T; + using ErrorType = E; + ErrorOr() requires(IsSame) : m_value_or_error(Empty {}) @@ -146,6 +149,7 @@ private: template class [[nodiscard]] ErrorOr : public ErrorOr { public: + using ResultType = void; using ErrorOr::ErrorOr; };