
17 Sep
2011
17 Sep
'11
8:34 a.m.
On 9/16/2011 1:24 PM, Emil Dotchevski wrote:
On Fri, Sep 16, 2011 at 11:11 AM, John M. Dlugosz
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
I guess that is what I'm trying to figure out. If two smart pointers manage the lifetime of the same entity, how can they not get() the same pointer? I see that they might be different addresses if they refer to the object by different types, but that is true for regular pointers, and bringing them to a common base class would allow them to compare equal.