mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-10 09:30:48 +08:00
Modeling Data - Simplify EmplaceValue in Array1 and Array2 (#1087)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user