cpp/memory/new/set new handler

Makes the new global new-handler function and returns the previously installed new-handler.

The new-handler function is the function called by whenever a memory allocation attempt fails. Its intended purpose is one of three things:

@1@ make more memory available,

@2@ terminate the program (e.g. by calling std),

@3@ throw exception of type std or derived from std.

The default implementation throws std. The user can install their own new-handler, which may offer behavior different than the default one.

If new-handler returns, the allocation function repeats the previously-failed allocation attempt and calls the new-handler again if the allocation fails again. To end the loop, new-handler may call : if, after a failed allocation attempt, allocation function finds that std returns a null pointer value, it will throw std.

At program startup, new-handler is a null pointer.

Return value
The previously-installed new handler, or a null pointer value if none was installed.