From 79545661b3e58e2b4c231576917dc96d22b6b85f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 26 Aug 2016 13:57:38 -0400 Subject: [PATCH] intrusive_list: De-duplicate some iterator code These increment/decrement variants can just leverage the other overloads. --- src/common/intrusive_list.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/intrusive_list.h b/src/common/intrusive_list.h index c7b402e7..3c3cab63 100644 --- a/src/common/intrusive_list.h +++ b/src/common/intrusive_list.h @@ -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; }