5 Mar
2006
5 Mar
'06
3:19 a.m.
Hello, The type of shared pointer I have in mind is boost::shared_ptr. Is there some way I can extend/modify (short of re-writing) cleanly its functionality such that when its reference counter becomes zero, a method in the actual pointer's class is called instead of that class's destructor being called? Consider the following snippet to allow me to explain: class A { public: A() { } ~A() { } void deleteA() { } }; boost::shared_ptr<A> a(new A); a.reset(); In this example, when a.reset() is called A's I want the deleteA() method to be called instead of the destructor for A. It would then be up to deleteA() to decide if/when to cause the delete of the real object. Best regards, -Arun.