I saw code like this:
void *NewElts = operator new(NewCapacityInBytes);
And matching call explicitly operator delete is used consequent later.
Why do this instead of:
void *NewElts = new char[NewCapacityInBytes];
Why explicit call to operator new and operator delete??
Explicitly calling
operator newlike that calls the global “raw” operator new. Globaloperator newreturns a raw memory block without calling the object’s constructor or any user-defined overloads ofnew. So basically, globaloperator newis similar tomallocfrom C.So: