Subject: Re: [boost] Weak pointer to object not managed by a shared_ptr
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2009-09-02 14:57:07
Andrey Semashev wrote:
> Mateusz Loskot wrote:
>> One of the smart pointer techniques  explains use of weak_ptr
>> pointer to object not managed by a shared_ptr.
>> 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.
The detection of dangling pointers is a good example of practical
use case of this guideline. It looks like it relates to the case in
serialization library pointed by Robert Ramey.
I see some light :-)
-- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk