mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Add fallible dequeue method to Queue
This commit is contained in:
parent
a65c385057
commit
1e749d023a
Notes:
sideshowbarker
2024-07-17 18:46:30 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/1e749d023a Pull-request: https://github.com/SerenityOS/serenity/pull/24025 Issue: https://github.com/SerenityOS/serenity/issues/22357 Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 8 additions and 0 deletions
|
@ -37,6 +37,14 @@ public:
|
|||
++m_size;
|
||||
}
|
||||
|
||||
ErrorOr<T> try_dequeue()
|
||||
{
|
||||
if (is_empty())
|
||||
return Error::from_errno(ENOENT);
|
||||
|
||||
return dequeue();
|
||||
}
|
||||
|
||||
T dequeue()
|
||||
{
|
||||
VERIFY(!is_empty());
|
||||
|
|
Loading…
Reference in a new issue