AK: Add fallible dequeue method to Queue

This commit is contained in:
Andrew Kaster 2024-04-17 16:38:43 -06:00 committed by Tim Flynn
parent a65c385057
commit 1e749d023a
Notes: sideshowbarker 2024-07-17 18:46:30 +09:00

View file

@ -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());