|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-01-20 09:34:15
----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, January 20, 2002 9:22 AM
Subject: Re: [boost] Re: shared_ptr: unsafe, or am I crazy?
> From: "David Abrahams" <david.abrahams_at_[hidden]>
> > From: "Peter Dimov" <pdimov_at_[hidden]>
> >
> > > True, there is no way to detect the general case where a shared_ptr is
> > being
> > > constructed from a T * that actually points to something derived from
T.
> >
> > Actually,
> >
> > typeid(*p) == typeid(T)
> >
> > Gets you about as far along as you could hope for (my current work uses
> > /lots/ of RTTI so this jumped out at me ;-)). Not that you'd probably
want
> > to pay for typeid.
>
> But unfortunately this fails (missed negative) for non-polymorphic T, and
> fails (false positive) for polymorphic T with a virtual destructor. ;-)
Yeah, it jumped out at me too soon :-(
-D
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk