Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-11-17 09:35:41


From: "David Abrahams" <dave_at_[hidden]>
> > I haven't encountered a need to inspect the deleter yet... what
interface
> > are you suggesting?
>
> How about:
>
> // attempt to extract a deleter of type D
> D* d = boost::get_deleter<D>(p);
> if (d)
> {
> // that was the deleter type used.
> }

Hmm. Do you really need access to the deleter, or only information about the
deleter type used? Or do you actually need an answer to the question "did I
create this shared_ptr?"

BTW, introspection isn't currently part of shared_ptr because whenever I
encounter a need for yet another shared_ptr feature, I always try _very
hard_ to solve the problem using only the existing public interface. This
unofficial filter has always worked well so far. :-) (And when I failed to
apply it - shared_from_this - it was a mistake.)

Have you considered keeping a std::set< weak_ptr<> > to track shared_ptr
instances created by boost.python? (Shot in the dark, don't yell at me if I
missed the point.)


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