Boost Users :
Subject: Re: [Boost-users] shared_ptr design question
From: Frank Mori Hess (fmhess_at_[hidden])
Date: 2011-09-17 10:47:07
On Saturday, September 17, 2011, John M. Dlugosz wrote:
> 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.
shared_ptr also has an aliasing copy constructor, where you can give it an
arbitrary pointer. So, you might make a shared_ptr that points at a struct
and a shared_ptr that points at a member of the same struct, but they both
share the same reference count and deleter.
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