# Miscellaneous Items

Topics
In-Place Construction

In-Place Construction

The placenew.h file defines an overloaded new operator used for the in-place construction of objects:

    inline void *operator new(size_t, void *ptr)
    {
      return ptr; // Return the same address passed in
    }

This overloaded new operator is used to place a new object at a user-defined address (in-place construction.) The compiler will insert the constructor call when it sees the new operator. The address of the object passed to the constructor (the this pointer) is returned by the new operator. NOTE: The size_t parameter is required by C++ syntax, but is not need because this function assumes that the proper space has already been allocated.

End Of Document