mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
AK: Use deducing this for AK::queue::head() and tail()
This allows us to grab these as mutable.
This commit is contained in:
committed by
Gregory Bertilson
parent
ac69815740
commit
ae9537a53c
Notes:
github-actions[bot]
2026-03-17 23:59:43 +00:00
Author: https://github.com/Zaggy1024 Commit: https://github.com/LadybirdBrowser/ladybird/commit/ae9537a53c1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8461
14
AK/Queue.h
14
AK/Queue.h
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user