From 19eeaf807d105667553e12487cf5a9eaff2e79cb Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 7 May 2019 16:06:48 +0200 Subject: AK: Add InlineLinkedList::remove_tail(). --- AK/InlineLinkedList.h | 9 +++++++++ 1 file changed, 9 insertions(+) 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 inline T* InlineLinkedList::remove_head() return node; } +template inline T* InlineLinkedList::remove_tail() +{ + T* node = tail(); + if (node) + remove(node); + return node; +} + template inline void InlineLinkedList::append(InlineLinkedList& other) { if (!other.head()) -- cgit v1.2.3