dimanche 8 mars 2015

What happens if a object to which a smart pointer is pointing to commits suicide?

I have objects that define their own "right of existence". Hence they have the possibility to commit suicide. What happens to a smart pointer that holds it? Will it be dangling or does the pointer recognises that the object destroyed itself and thus point to NULL automatically?


From outside the object I would use ptr.reset(). But what can I do from inside the object?


Aucun commentaire:

Enregistrer un commentaire