0025348: Method Assign of NCollection containers must not change own allocator of...
[occt.git] / src / NCollection / NCollection_List.hxx
index 6ef0b32..b525603 100644 (file)
@@ -73,20 +73,21 @@ public:
   Standard_Integer Size (void) const
   { return Extent(); }
 
-  //! Replace this list by the items of another list (theOther parameter)
-  void Assign (const NCollection_List& theOther)
+  //! Replace this list by the items of another list (theOther parameter).
+  //! This method does not change the internal allocator.
+  NCollection_List& Assign (const NCollection_List& theOther)
   {
     if (this != &theOther) {
-      Clear(theOther.myAllocator);
+      Clear();
       appendList(theOther.PFirst());
     }
+    return *this;
   }
 
   //! Replacement operator
   NCollection_List& operator= (const NCollection_List& theOther)
   {
-    Assign (theOther);
-    return *this;
+    return Assign (theOther);
   }
 
   //! Clear this list