1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 18:37:36 +00:00

Kernel: Add KResultOr<T>::result()

This is just a handy way to get either an error or a KSuccess, even if
there is a T present.
This commit is contained in:
Andreas Kling 2020-02-08 11:57:13 +01:00
parent 745ea2a0ef
commit 2f82d4fb31

View file

@ -119,6 +119,7 @@ public:
ASSERT(m_is_error); ASSERT(m_is_error);
return m_error; return m_error;
} }
KResult result() const { return m_is_error ? KSuccess : m_error; }
T& value() T& value()
{ {
ASSERT(!m_is_error); ASSERT(!m_is_error);