Return the old destructor pointer in mem_destructor() #1176
Replies: 2 comments
-
I'm not against this, but I wonder how helpful it really is. |
Beta Was this translation helpful? Give feedback.
-
In my case I need to extend the destruction process of a call structure with a method that perform some other cleanup and logging. Because the call's destructor already knows how to destroy the call structure and ideally is hidden from the client, I would not copy the default call destructor code into the new one, but I would have the new one perform its own things and then call the old destructor so it can destroy the call object. By modifying mem_destructor to return a pointer to the previous destructor, the new one can do its own things and then simply call the previous destructor to take care of the complete removal of the structure. |
Beta Was this translation helpful? Give feedback.
-
mem_destructor() allows to set a referenced memory destructor.
However, a new destructor may still want to call the previously set destructor.
For instance, a new destructor may just want to perform some other action before continuing the destruction process as before (notifying some other object, logging, etc).
For this reason I propose to add a return value to mem_destructor so that the new destructor can simply continue the previous destruction process:
Beta Was this translation helpful? Give feedback.
All reactions