placement new is used to create an object at a known location. placement new operator is different from ‘new. operator in c++. new creates an object at heap while ‘placement new’ places the object at a predefined address. using placement new requires header #include<new>.

what is placement new in cppSyntax for placement new

what is placement new in cpp? write an example

output

Usage of placement new

  • Achieving c++ polymorphism without the heap.
  • memory mapped i/o in embedded system.

Ref:

http://www.drdobbs.com/cpp/calling-constructors-with-placement-new/232901023

http://m.eet.com/media/1171524/f-dailey.pdf