Boost logo

Boost Users :

From: James Hughes (JHughes_at_[hidden])
Date: 2006-03-20 11:28:55


> -----Original Message-----
> From: Alan M. Carroll [mailto:amc_at_[hidden]]
> Sent: 20 March 2006 13:44
> To: boost-users_at_[hidden]
> Cc: boost-users_at_[hidden]
> Subject: Re: [Boost-users] enable_shared_from_this - or an
> alternative..
>
>
> At 04:13 AM 3/20/2006, James Hughes wrote:
> >Hello All,
> >
> >I have a couple of classes that I want to self register
> themselves with a
> >monitoring class. To do this they must pass a shared_ptr of
> themselves to
> >the monitor register function.
> >
> >Therefore I need to make a shared_ptr form the this pointer, in the
> >constructor.
>
> Why not use intrusive_ptr? Way back when, I wrote my own
> equivalent of that instead of using Boost.shared_ptr partly
> for this very reason (i.e., having to use smart pointers in
> constructors).
>

Ah, just read my Boost book on intrusive pointers and I think they would
work. Not sure I will use for current issues, as have now written code for a
factory mechanism (which appears to work!), but certainly worth knowing for
the future. Thanks

Rgds

James


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