From 962de60cceb20dbfa52d473917bfe3b0b60e070a Mon Sep 17 00:00:00 2001 From: key-value-pair Date: Fri, 17 May 2019 23:24:53 +0800 Subject: [PATCH] fix operator++(int), operator--(int) bug --- include/onnc/ADT/NodeIterator.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/onnc/ADT/NodeIterator.h b/include/onnc/ADT/NodeIterator.h index f0acfa3fb..3206c3ed5 100644 --- a/include/onnc/ADT/NodeIterator.h +++ b/include/onnc/ADT/NodeIterator.h @@ -159,13 +159,15 @@ NodeIterator& NodeIterator::operator--() template class Traits> NodeIterator NodeIterator::operator++(int) { - return NodeIterator(node()->getNextNode()); + m_pNodePtr = m_pNodePtr->next; + return NodeIterator(node()->getPrevNode()); } template class Traits> NodeIterator NodeIterator::operator--(int) { - return NodeIterator(node()->getPrevNode()); + m_pNodePtr = m_pNodePtr->prev; + return NodeIterator(node()->getNextNode()); } } // namespace of onnc