AK: Make ErrorOr::error() const and return a const reference

This commit is contained in:
Lucas CHOLLET 2022-06-16 13:14:20 +02:00 committed by Sam Atkins
parent 6900c4fe29
commit 42518867d7
Notes: sideshowbarker 2024-07-17 06:34:47 +09:00

View file

@ -139,7 +139,7 @@ public:
ErrorOr& operator=(ErrorOr&& other) = default;
ErrorOr& operator=(ErrorOr const& other) = default;
ErrorType& error() { return m_error.value(); }
ErrorType const& error() const { return m_error.value(); }
bool is_error() const { return m_error.has_value(); }
ErrorType release_error() { return m_error.release_value(); }
void release_value() { }