boost::shared_ptr destruir devolución de llamada

I was digging through documentation of boost, looking for callback which is called just before object in boost::shared_ptr is being deleted, so i can write object state back to hard drive, and remove weak_ptr element from std::map.

¿Alguien sabe cómo lidiar con este problema?

preguntado el 25 de agosto de 12 a las 04:08

2 Respuestas

When the shared pointer is deleted it should call your objects destructor. You can write your object to the disk at that time, right there in its destructor.

Respondido 25 ago 12, 04:08

You can pass a deleter function to shared ptr and write object state in this function.

template<class Y, class D> shared_ptr(Y * p, D d);

Respondido 25 ago 12, 04:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.