mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:17:35 +00:00
Kernel: KResultOr can use the same storage as the object for the error
Since it can only hold either an object or an error code, we can share the same storage to hold either.
This commit is contained in:
parent
79bab28f5e
commit
1d843c46eb
1 changed files with 4 additions and 2 deletions
|
@ -172,8 +172,10 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
alignas(T) char m_storage[sizeof(T)];
|
||||
KResult m_error;
|
||||
union {
|
||||
alignas(T) char m_storage[sizeof(T)];
|
||||
KResult m_error;
|
||||
};
|
||||
bool m_is_error { false };
|
||||
bool m_have_storage { false };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue