From 7b7f4eb1411c75c76e2cd78cb3141156ffb1893f Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 30 Mar 2023 18:39:55 +0300 Subject: [PATCH] BAN: LinkedList::remove now returns iterator to the element after --- BAN/include/BAN/LinkedList.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BAN/include/BAN/LinkedList.h b/BAN/include/BAN/LinkedList.h index 8c6cb71f1f..2098d707b9 100644 --- a/BAN/include/BAN/LinkedList.h +++ b/BAN/include/BAN/LinkedList.h @@ -38,7 +38,7 @@ namespace BAN ErrorOr emplace(iterator, Args&&...); void pop_back(); - void remove(iterator); + iterator remove(iterator); void clear(); iterator begin() { return iterator(m_data, empty()); } @@ -201,7 +201,7 @@ namespace BAN } template - void LinkedList::remove(iterator iter) + LinkedList::iterator LinkedList::remove(iterator iter) { ASSERT(!empty() && iter); Node* node = iter.m_current; @@ -212,6 +212,7 @@ namespace BAN (prev ? prev->next : m_data) = next; (next ? next->prev : m_last) = prev; m_size--; + return next ? iterator(next, false) : iterator(m_last, true); } template