int *p=new int(7)
delete p;
could be written as
void* buf=operator new(sizeof(int) );
int* p=new (buf) int(7);
operator delete(p);
My question is how to use operator new, placement new to allocate and initialize the storage and use operator delete to deallocate the storage?
BTW, why the inline specifier for a member function can appear in the declaration or the definition or both;whereas the const specifier fo a member function must appear in both of them?
delete p;
could be written as
void* buf=operator new(sizeof(int) );
int* p=new (buf) int(7);
operator delete(p);
My question is how to use operator new, placement new to allocate and initialize the storage and use operator delete to deallocate the storage?
BTW, why the inline specifier for a member function can appear in the declaration or the definition or both;whereas the const specifier fo a member function must appear in both of them?
Comment