mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
AK: Add fallible dequeue method to Queue
This commit is contained in:
1 parent
a65c385057
commit
1e749d023a
1 file changed
+8
@@ -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