On Monday, 17 April 2017 at 13:21:50 UTC, Kagamin wrote:

If we can control memory layout, we can do what shared_ptr does and couple the reference counter with the object, then we can have just one pointer:

struct RefCounted(T)
{
  struct Wrapper
  {
    int count;
    T payload;
  }
  Wrapper* payload;
}

I'm not sure I follow your comment. Indeed, that is how shared_ptr, or, in this case, RefCounted, is implemented. My point was that there is no practical sense in having a shared(RefCounted).

Reply via email to