1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

Kernel: Make KResult usable with TRY() as well

This patch adds release_error() and release_value() to KResult, making
it usable with TRY().

Note that release_value() returns void, since there is no value inside
a KResult.
This commit is contained in:
Andreas Kling 2021-09-05 14:49:49 +02:00
parent 71187d865e
commit e1af24eac8

View file

@ -40,6 +40,10 @@ public:
bool operator!=(KSuccessTag) const { return is_error(); }
bool operator==(KSuccessTag) const { return !is_error(); }
// NOTE: These are here to make KResult usable with TRY()
KResult release_error() { return *this; }
void release_value() { }
private:
template<typename T>
friend class KResultOr;