Boost logo

Boost Users :

From: Hughes, James (jhughes_at_[hidden])
Date: 2007-03-19 11:07:37


 

> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Vaclav
> Sent: 19 March 2007 14:19
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] which type of smart pointer to use?
>
> That seems to work. Thank you!
>
> btw is this the correct test?
>
> if(myweakPtr2.use_count() > 0)
>

I believe you should lock the weak_ptr to a smart point and test that.

shared_ptr<x> p = weak.lock()

if (p)
{
...
}

But I could be wrong!

James

> or it there a better way to check whether a smart pointer is
> still pointing?
>
> Thanks
> Vaclav
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

This message (including any attachments) contains confidential
and/or proprietary information intended only for the addressee.
Any unauthorized disclosure, copying, distribution or reliance on
the contents of this information is strictly prohibited and may
constitute a violation of law. If you are not the intended
recipient, please notify the sender immediately by responding to
this e-mail, and delete the message from your system. If you
have any questions about this e-mail please notify the sender
immediately.


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