throw
:
throw(TMyException exception(error value));
new
operator), you can ensure that it will be deleted after it is thrown by using the exception object's ThrowAndDelete() member function to throw the exception:
TMyException exception(error value); exception.ThrowAndDelete();