Преглед изворни кода

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