mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
AK: Make Vector::try_* functions return ErrorOr<void>
Instead of signalling allocation failure with a bool return value (false), we now use ErrorOr<void> and return ENOMEM as appropriate. This allows us to use TRY() and MUST() with Vector. :^)
This commit is contained in:
parent
cd49f30bea
commit
88b6428c25
16 changed files with 98 additions and 152 deletions
|
@ -311,7 +311,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
auto previous_size = m_elements.size();
|
||||
if (!m_elements.try_resize(new_size))
|
||||
if (m_elements.try_resize(new_size).is_error())
|
||||
return false;
|
||||
for (size_t i = previous_size; i < m_elements.size(); ++i)
|
||||
m_elements[i] = fill_value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue