AK: Add Queue::head()

This returns a const T& for the first element in the queue, without
dequeuing it.
This commit is contained in:
Andreas Kling 2019-11-03 12:09:19 +01:00
parent c1d3ac7108
commit 78a744da77
Notes: sideshowbarker 2024-07-19 11:27:23 +09:00

View file

@ -40,6 +40,12 @@ public:
return value; return value;
} }
const T& head() const
{
ASSERT(!is_empty());
return (*m_segments.first())[m_index_into_first];
}
void clear() void clear()
{ {
m_segments.clear(); m_segments.clear();