浏览代码

fix array iterator != and == operators for empty arrays

Kolja Strohm 3 周之前
父节点
当前提交
81603f7988
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      Array.h

+ 6 - 2
Array.h

@@ -243,12 +243,16 @@ namespace Framework
 
         bool operator!=(ArrayIterator<TYP>& r)
         {
-            return current != r.current;
+            return current != r.current
+                || ((!current || !current->set)
+                    && (!r.current || !r.current->set));
         }
 
         bool operator==(ArrayIterator<TYP>& r)
         {
-            return current == r.current;
+            return current == r.current
+                || ((!current || !current->set)
+                    && (!r.current || !r.current->set));
         }
 
         void remove() override