|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-12-12 10:19:08
From: "abierbaum" <allenb_at_[hidden]>
> The problem boils down to:
>
> How do I pass a reference to myself ( shared_ptr<TYPE>(this) ) to
> someone else in a safe way?
To solve this problem I implemented an intrusive smart pointer (that calls
add_ref() and release() on the contained object.)
shared_ptr<> (or any other non-intrusive smart pointer) cannot be safely
constructed from a raw pointer (that is already owned by another
shared_ptr.) It's technically possible to maintain a global map of addresses
but I don't think it's worth it.
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk