From ae9537a53c11322e279ed76389cfa23a03c9dd25 Mon Sep 17 00:00:00 2001 From: Zaggy1024 Date: Mon, 16 Mar 2026 21:26:56 -0500 Subject: [PATCH] AK: Use deducing this for AK::queue::head() and tail() This allows us to grab these as mutable. --- AK/Queue.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/AK/Queue.h b/AK/Queue.h index 28a675e57e..112f1679f6 100644 --- a/AK/Queue.h +++ b/AK/Queue.h @@ -64,16 +64,18 @@ public: return value; } - T const& head() const + template + auto&& head(this Self&& self) { - VERIFY(!is_empty()); - return m_segments.first()->data[m_index_into_first]; + VERIFY(!self.is_empty()); + return self.m_segments.first()->data[self.m_index_into_first]; } - T& tail() + template + auto&& tail(this Self&& self) { - VERIFY(!is_empty()); - return m_segments.last()->data.last(); + VERIFY(!self.is_empty()); + return self.m_segments.last()->data.last(); } template