26 Aug
2014
26 Aug
'14
7:58 p.m.
On Tue, Aug 26, 2014 at 3:50 PM, Bruce Stephens
On Tue, Aug 26, 2014 at 8:35 PM, Hickman, Steve (AdvTech)
wrote:
Why doesn’t the Smart Pointer library decouple the reference counting from the action to be taken and provide a generic reference counting mechanism that will call an arbitrary function when the count goes to zero? The
You can pass in a deleter (it's an argument to the constructors, not part of the type). Doesn't that do what you want?
Then there's intrusive_ptr<T>, which for a given T calls user-specified functions for both incrementing and decrementing the refcount... http://www.boost.org/doc/libs/1_56_0/libs/smart_ptr/intrusive_ptr.html