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;
return *this;
}
IntrusiveListIterator operator++(int) {
IntrusiveListIterator it(*this);
node = node == root ? node : node->next;
return it;
}
IntrusiveListIterator& operator--() {
node = node->prev == root ? node : node->prev;
return *this;
}
IntrusiveListIterator operator++(int) {
IntrusiveListIterator it(*this);
++*this;
return it;
}
IntrusiveListIterator operator--(int) {
IntrusiveListIterator it(*this);
node = node->prev == root ? node : node->prev;
--*this;
return it;
}