Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 2002-02-08 21:51:37


On 2/8/02 5:46 PM, "Joe Gottman" <joegottman_at_[hidden]> wrote:

> I just downloaded weak_ptr, and I was wondering how useful it is. What
> can you do with a weak_ptr<T> that you can't do with a plain T*?

You can check if it's 0.

A plain T* will become a dangling pointer if the underlying object is
deleted because the last shared_ptr goes away.

A weak_ptr will become 0, and you can test for that.

That's the only difference.

    -- Darin


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