[Switch] so that the new operator to allocate memory not only call the constructor

Transfer from   https://www.jianshu.com/p/b52a5df69c88

c ++ new operator in the corresponding constructor is usually complete assignment of memory and the two calls.
I ask you:
1) how to make the new operator does not allocate memory, just call the constructor?
2) such use what's the use?

 

placement new is mainly applied to:

In time very demanding applications, because these programs are assigned to the determined time; long running program without being interrupted; and performing a garbage collector (garbage collector).

Guess you like

Origin www.cnblogs.com/yi-mu-xi/p/11057393.html