mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Add fallible dequeue method to Queue
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user