The PTR_NEW function provides the primary mechanism for creating heap variables. It returns a pointer to the created variable.
If InitExpr is provided, PTR_NEW uses it to initialize the newly created heap variable. Note that the new heap variable does not point at the InitExpr variable in any sense--the new heap variable simply contains a copy of its value.
If InitExpr is not provided, PTR_NEW does not create a new heap variable, and returns the Null Pointer, a special pointer with a fixed known value that can never point at a heap variable. The null pointer is useful as a terminator in dynamic data structures, or as a placeholder in structure definitions.
Usually, when the InitExpr argument is provided, PTR_NEW allocates additional memory to make a copy. If the NO_COPY keyword is set, the value data is taken away from the InitExpr variable and attached directly to the heap variable. This feature can be used to move data very efficiently. However, it has the side effect of causing the InitExpr variable to become undefined. Using the NO_COPY keyword is completely equivalent to the statement: