0031671: Coding Rules - eliminate warnings issued by clang 11
[occt.git] / src / NCollection / NCollection_BaseVector.hxx
index 9b32c0c..db68b86 100755 (executable)
@@ -79,15 +79,8 @@ protected:
       initV (theVector, theToEnd);
     }
 
-    Iterator (const Iterator& theVector)
-    {
-      copyV (theVector);
-    }
-
     Standard_EXPORT void initV (const NCollection_BaseVector& theVector, Standard_Boolean theToEnd = Standard_False);
 
-    Standard_EXPORT void copyV (const Iterator&);
-
     Standard_Boolean moreV() const
     {
       return (myICurBlock < myIEndBlock || myCurIndex < myEndIndex);
@@ -117,6 +110,13 @@ protected:
       const Standard_Integer anIndex = myCurIndex + myICurBlock * myVector->myIncrement + theOffset;
       myICurBlock = anIndex / myVector->myIncrement;
       myCurIndex = anIndex % myVector->myIncrement;
+      if (myICurBlock > myIEndBlock)
+      {
+        // make sure that iterator produced by Offset()
+        // is equal to the end() iterator
+        --myICurBlock;
+        myCurIndex += myVector->myIncrement;
+      }
     }
 
     Standard_Integer differV (const Iterator& theOther) const
@@ -129,6 +129,7 @@ protected:
       return &myVector->myData[myICurBlock];
     }
 
+  protected:
     const NCollection_BaseVector* myVector;    //!< the Master vector
     Standard_Integer              myICurBlock; //!< # of the current block
     Standard_Integer              myIEndBlock;
@@ -212,6 +213,12 @@ public: //! @name public API
     }
   }
 
+  //! Returns attached allocator
+  const Handle(NCollection_BaseAllocator)& Allocator() const
+  {
+    return myAllocator;
+  }
+
 protected: //! @name Protected fields
 
   Handle(NCollection_BaseAllocator) myAllocator;