AK: Use deducing this for AK::queue::head() and tail()
This allows us to grab these as mutable.
This commit is contained in:
parent
ac69815740
commit
ae9537a53c
1 changed files with 8 additions and 6 deletions
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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue