First, do not confuse the new / delete expression with the operator new() function .
An expression is a language construct that performs construction and destruction. An operator is a regular function that performs memory allocation (de).
Only the default operator new(size_t) ( operator new(size_t) and operator delete(void *) can be used with the default expressions new and delete . All other forms are called βlayoutβ formats, and for those that you can only use new , but you need to destroy the objects manually by calling the destructor. Placement forms have a rather limited and specialized need. The most useful form of placement is global placement-new, ::new (addr) T , but this behavior cannot be changed (which, apparently, why is it the only popular ny).
The new operators must return void * . These distribution functions are much lower level than you would appreciate, so basically you "will know when you need to mess with them."
Repeat: C ++ shares the concepts of object construction and memory allocation. All you can do is provide alternative implementations for the latter.
source share