Boost logo

Boost :

Subject: Re: [boost] [shared_ptr] enable_shared_from_any ?
From: Philip Warner (pjw_at_[hidden])
Date: 2010-05-17 19:15:15


On 17/05/2010 11:20 PM, Frank Mori Hess wrote:
> Are you saying you want to have a covariant return types with
> shared_ptr?

Among other things, yes. But the bulk of my message was effectively
suggesting replacing enable_shared_from_this{2} with
enable_shared_from_any to allow safe creation of shared_ptrs from any
pointer to an object that inherits from enable_shared_from_any.

I have not tested your specific example, but it looks a lot like one of
the many attempts we have made in the past to return covariant pointers.
AFAICT, for good reasons, it is just not possible.


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