Boost logo

Boost Users :

Subject: Re: [Boost-users] privately inherit enable_shared_from_this?
From: Eric J. Holtman (eric_at_[hidden])
Date: 2009-12-11 13:43:46


Peter Dimov wrote:
>
> One way to make it work is to add
>
> friend class boost::enable_shared_from_this<Request>;
> friend class boost::shared_ptr<Request>;
>
> to Request.
> _______________________________________________

Hmmm.... this "works", but Request is actually the root
of a very large tree, and all my nodes get broken in
the same way now.

i.e.

class Forecast_Snapshot_Request : public Request {
    boost::shared_ptr<Request> build () { return shared_ptr<Request>
(new Forecast_Snapshot_Request); };
};

fails with

1>c:\boost\boost_1_40_0\boost\smart_ptr\shared_ptr.hpp(189) : error
C2243: 'type cast' : conversion from 'Forecast_Snapshot_Request *' to
'const boost::enable_shared_from_this<T> *' exists, but is inaccessible

I tried add more friend decls, but no dice.

Sigh.

Maybe I'll just add documention to call my wrapper,
not shared_from_this ().


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net