summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-05-07 16:06:48 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-07 16:06:48 +0200
commit19eeaf807d105667553e12487cf5a9eaff2e79cb (patch)
tree5e667e65e704772ccea7f4c310c61a728f58a28e /AK
parent11b99dd89acdb19ecbe2e6c998dd9637c1a149a0 (diff)
downloadserenity-19eeaf807d105667553e12487cf5a9eaff2e79cb.zip
AK: Add InlineLinkedList::remove_tail().
Diffstat (limited to 'AK')
-rw-r--r--AK/InlineLinkedList.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/AK/InlineLinkedList.h b/AK/InlineLinkedList.h
index 5773e92232..a6156c4284 100644
--- a/AK/InlineLinkedList.h
+++ b/AK/InlineLinkedList.h
@@ -52,6 +52,7 @@ public:
T* head() const { return m_head; }
T* remove_head();
+ T* remove_tail();
T* tail() const { return m_tail; }
@@ -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())