Boost logo

Boost Users :

From: Hickman, Greg (greg.hickman_at_[hidden])
Date: 2002-11-26 19:09:08


> -----Original Message-----
> From: Peter Dimov [mailto:pdimov_at_[hidden]]
> Sent: Tuesday, November 26, 2002 6:49 AM
> To: Boost-Users_at_[hidden]
> Subject: Re: [Boost-Users] Is intrusive_ptr the thing to use?

> If 'f' is virtual, have the object store a weak_ptr to itself:
>
> class X
> {
> private:
>
> weak_ptr<X> weak_this;
>
> X();
> X(X const &);
> X& operator=(X const &);
>
> public:
>
> static shared_ptr<X> create()
> {
> shared_ptr<X> px(new X);
> px->weak_this = px;
> return px;
> }

I must be missing something here, because it appears as though you can't
derive a Y from X and still initialize X::weak_this.

-Greg


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