BAN: LinkedList::remove now returns iterator to the element after
This commit is contained in:
parent
d4c03d3939
commit
7b7f4eb141
|
@ -38,7 +38,7 @@ namespace BAN
|
||||||
ErrorOr<void> emplace(iterator, Args&&...);
|
ErrorOr<void> emplace(iterator, Args&&...);
|
||||||
|
|
||||||
void pop_back();
|
void pop_back();
|
||||||
void remove(iterator);
|
iterator remove(iterator);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
iterator begin() { return iterator(m_data, empty()); }
|
iterator begin() { return iterator(m_data, empty()); }
|
||||||
|
@ -201,7 +201,7 @@ namespace BAN
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void LinkedList<T>::remove(iterator iter)
|
LinkedList<T>::iterator LinkedList<T>::remove(iterator iter)
|
||||||
{
|
{
|
||||||
ASSERT(!empty() && iter);
|
ASSERT(!empty() && iter);
|
||||||
Node* node = iter.m_current;
|
Node* node = iter.m_current;
|
||||||
|
@ -212,6 +212,7 @@ namespace BAN
|
||||||
(prev ? prev->next : m_data) = next;
|
(prev ? prev->next : m_data) = next;
|
||||||
(next ? next->prev : m_last) = prev;
|
(next ? next->prev : m_last) = prev;
|
||||||
m_size--;
|
m_size--;
|
||||||
|
return next ? iterator(next, false) : iterator(m_last, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
Loading…
Reference in New Issue