Переглянути джерело

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

Kolja Strohm 3 тижнів тому
батько
коміт
fecec60a42
1 змінених файлів з 6 додано та 2 видалено
  1. 6 2
      Array.h

+ 6 - 2
Array.h

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