boost::shared_ptr destruir devolución de llamada
Frecuentes
Visto 771 veces
0
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?
2 Respuestas
4
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
2
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 c++ boost shared-ptr or haz tu propia pregunta.