From 78a744da7768a6ba1ec8a300a504647531e9ce86 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 3 Nov 2019 12:09:19 +0100 Subject: [PATCH] AK: Add Queue::head() This returns a const T& for the first element in the queue, without dequeuing it. --- AK/Queue.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AK/Queue.h b/AK/Queue.h index 7a21c51b3a..157e07ea07 100644 --- a/AK/Queue.h +++ b/AK/Queue.h @@ -40,6 +40,12 @@ public: return value; } + const T& head() const + { + ASSERT(!is_empty()); + return (*m_segments.first())[m_index_into_first]; + } + void clear() { m_segments.clear();