Skip to content

Commit

Permalink
AK: Add InlineLinkedList::remove_tail().
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed May 7, 2019
1 parent 11b99dd commit 19eeaf8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions AK/InlineLinkedList.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ template<typename T> class InlineLinkedList {

T* head() const { return m_head; }
T* remove_head();
T* remove_tail();

T* tail() const { return m_tail; }

Expand Down Expand Up @@ -151,6 +152,14 @@ template<typename T> inline T* InlineLinkedList<T>::remove_head()
return node;
}

template<typename T> inline T* InlineLinkedList<T>::remove_tail()
{
T* node = tail();
if (node)
remove(node);
return node;
}

template<typename T> inline void InlineLinkedList<T>::append(InlineLinkedList<T>& other)
{
if (!other.head())
Expand Down

0 comments on commit 19eeaf8

Please sign in to comment.