Modeling Data - Simplify EmplaceValue in Array1 and Array2 (#1087)

This commit is contained in:
Pasukhin Dmitry
2026-02-14 13:43:11 +00:00
committed by GitHub
parent d515004353
commit 04068e3aea
2 changed files with 4 additions and 8 deletions

View File

@@ -334,10 +334,8 @@ public:
{
const size_t aPos = theIndex - myLowerBound;
Standard_OutOfRange_Raise_if(aPos >= mySize, "NCollection_Array1::EmplaceValue");
pointer aPnt = myPointer + aPos;
myAllocator.destroy(aPnt);
myAllocator.construct(aPnt, std::forward<Args>(theArgs)...);
return *aPnt;
myPointer[aPos] = value_type(std::forward<Args>(theArgs)...);
return myPointer[aPos];
}
//! Changes the lowest bound. Do not move data

View File

@@ -315,10 +315,8 @@ public:
{
const size_t aPos = (theRow - myLowerRow) * mySizeCol + (theCol - myLowerCol);
Standard_OutOfRange_Raise_if(aPos >= this->mySize, "NCollection_Array2::EmplaceValue");
pointer aPnt = this->myPointer + aPos;
this->myAllocator.destroy(aPnt);
this->myAllocator.construct(aPnt, std::forward<Args>(theArgs)...);
return *aPnt;
this->myPointer[aPos] = value_type(std::forward<Args>(theArgs)...);
return this->myPointer[aPos];
}
//! Resizes the array to specified bounds.