Boost logo

Boost :

Subject: Re: [boost] Weak pointer to object not managed by a shared_ptr
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-09-02 13:53:14


Mateusz Loskot wrote:
> Hi,
>
> One of the smart pointer techniques [1] explains use of weak_ptr
> pointer to object not managed by a shared_ptr.
>
> [1] http://www.boost.org/doc/libs/1_40_0/libs/smart_ptr/sp_techniques.html
>
> I'm wondering what would be practical use case of that?
> Is it a part of any of known idioms or patterns?

I know, it's not a design guideline to follow but I used the technique
to implement pointers that may be checked for being dangling. I needed
this to quick fix a problem in a quite complicated code that sometimes
crashed due to raw dangling pointers.


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