Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-11-18 08:46:29


"Peter Dimov" <pdimov_at_[hidden]> writes:

> From: "David Abrahams" <dave_at_[hidden]>
>
>> I realize my case is somewhat unusual. I can't really argue that it
>> warrants publicizing deleter introspection for
>> everybody... however, since we're all part of a big happy Boost
>> family and I /could/ always switch to a map if the shared_ptr
>> implementation changes, how bad would it be for me to use my hack?
>
> There isn't anything bad. What I really ask is your opinion on
> whether get_deleter<> should be proposed for the TR, i.e. whether
> the technique of storing private data in shared_ptr deleters and
> then getting it back when you happen to encounter one of your
> shared_ptrs is of general utility, considering that a general
> alternative (map<weak_ptr<void>, Data>) exists.

I think that considering the alternatives require:

   1. Periodic map sweeps (we might as well be doing GC ;->), or

   2. Solving the constructor forwarding problem for tacking on
      additional data to the pointed-to class

IMO it's worth giving serious consideration to deleter
introspection. It seems like a fairly general class of problem to want
to find out the actual resource that is being managed by a given
shared_ptr.

-Dave

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk