|
Boost Users : |
Subject: Re: [Boost-users] shared_ptr design question
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2011-09-16 14:24:36
On Fri, Sep 16, 2011 at 11:11 AM, John M. Dlugosz
<mpbecey7gu_at_[hidden]> 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
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