intrusive_list: De-duplicate some iterator code

These increment/decrement variants can just leverage the other
overloads.
This commit is contained in:
Lioncash 2016-08-26 13:57:38 -04:00 committed by MerryMage
parent 4f6ea715b2
commit 79545661b3

View file

@ -68,18 +68,18 @@ public:
node = node == root ? node : node->next; node = node == root ? node : node->next;
return *this; return *this;
} }
IntrusiveListIterator operator++(int) {
IntrusiveListIterator it(*this);
node = node == root ? node : node->next;
return it;
}
IntrusiveListIterator& operator--() { IntrusiveListIterator& operator--() {
node = node->prev == root ? node : node->prev; node = node->prev == root ? node : node->prev;
return *this; return *this;
} }
IntrusiveListIterator operator++(int) {
IntrusiveListIterator it(*this);
++*this;
return it;
}
IntrusiveListIterator operator--(int) { IntrusiveListIterator operator--(int) {
IntrusiveListIterator it(*this); IntrusiveListIterator it(*this);
node = node->prev == root ? node : node->prev; --*this;
return it; return it;
} }