Boost logo

Boost Users :

From: Matt.Sullivan_at_[hidden]
Date: 2006-09-25 05:11:21


Hi,

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())
but it feels wrong to create a temporary with some small locking overhead -
even though I realise it will make absolutely no difference to performance.

So, my question is really why is there no operator==(shared_ptr, weak_ptr)?
Google provided little explanation other than this:
http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2004/n1590.html which
approaches the subject but isn't exactly authoritative.

thanks,
Matt


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