瀏覽代碼

Fixes to multilevelqueue's iterator.

Fernando Sahmkow 7 年之前
父節點
當前提交
f35e09fe0d
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      src/common/multi_level_queue.h

+ 5 - 1
src/common/multi_level_queue.h

@@ -35,7 +35,11 @@ public:
         using difference_type = typename std::pointer_traits<pointer>::difference_type;
 
         friend bool operator==(const iterator_impl& lhs, const iterator_impl& rhs) {
-            return (lhs.IsEnd() && rhs.IsEnd()) || lhs.it == rhs.it;
+            if (lhs.IsEnd() && rhs.IsEnd())
+                return true;
+            if (lhs.current_priority == rhs.current_priority)
+                return lhs.it == rhs.it;
+            return false;
         }
 
         friend bool operator!=(const iterator_impl& lhs, const iterator_impl& rhs) {