Pregunta de entrevista de Bloomberg

how does a reference counting smart pointger work?

Respuesta de la entrevista

Anónimo

4 de ene de 2010

I remeber the smart pointer is a class with a pointer member which points to the actual object and a counter member to record how many pointers point to the object. If the number of the counter is 0, then call the destructor function to delete the object. This smart pointer is to provent dangle pointer.