
16 Sep
2011
16 Sep
'11
12:24 p.m.
On Fri, Sep 16, 2011 at 11:11 AM, John M. Dlugosz <mpbecey7gu@snkmail.com> wrote:
I'm wondering why there is not an efficient built-in way to check whether two things (e.g. a shared_ptr and a weak_ptr, but any combination should work) refer to the same object.
It depends what you mean by "refer to the same object". You can use !(p1<p2) && !(p2<p1) with either shared_ptr or weak_ptr, which will tell you if they manage the lifetime of the same instance (or are both empty), but that doesn't necessarily mean that shared_ptr::get would return the same pointer for both. Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode