Boost logo

Boost Users :

From: Phillip Hellewell (sshock_at_[hidden])
Date: 2006-09-25 09:50:56


On 9/25/06, Matt.Sullivan_at_[hidden] <
Matt.Sullivan_at_[hidden]> wrote:
>
> Probably a newbie question, but what's the best way to test if a
> shared_ptr
> and weak_ptr point to the same thing?
>
> My current code uses: if (shared_ptr != weak_ptr.lock())
>

I don't know for sure, but can't you convert the shard_ptr to a weak_ptr and
write this:
     if( weak_ptr(shared_ptr) != weak_ptr )

Phillip



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