From 56a6d7924eeeb38df065494c9f3a9b476225abf7 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Tue, 27 Apr 2021 16:16:44 +0430 Subject: [PATCH] AK: Let Result know its Value and Error types It's much easier to ask for T::ValueType than for RemoveReference().release_value())> --- AK/Result.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/AK/Result.h b/AK/Result.h index 585b63d4ff..edfb3f8927 100644 --- a/AK/Result.h +++ b/AK/Result.h @@ -11,9 +11,12 @@ namespace AK { -template +template class [[nodiscard]] Result { public: + using ValueType = ValueT; + using ErrorType = ErrorT; + Result(const ValueType& res) : m_result(res) { @@ -69,9 +72,12 @@ private: }; // Partial specialization for void value type -template -class [[nodiscard]] Result { +template +class [[nodiscard]] Result { public: + using ValueType = void; + using ErrorType = ErrorT; + Result(const ErrorType& error) : m_error(error) {