Pārlūkot izejas kodu

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

Kolja Strohm 3 nedēļas atpakaļ
vecāks
revīzija
fecec60a42
1 mainītis faili ar 6 papildinājumiem un 2 dzēšanām
  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