AK: Use deducing this for AK::queue::head() and tail()

This allows us to grab these as mutable.
This commit is contained in:
Zaggy1024
2026-03-16 21:26:56 -05:00
committed by Gregory Bertilson
parent ac69815740
commit ae9537a53c
Notes: github-actions[bot] 2026-03-17 23:59:43 +00:00

View File

@@ -64,16 +64,18 @@ public:
return value;
}
T const& head() const
template<typename Self>
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<typename Self>
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<typename F>