title: C++ smart pointers: sharing pointers vs. sharing data
body: <p>In this <a href="https://web.archive.org/web/20100318031119/http://labs.trolltech.com:80/blogs/2009/08/25/count-with-me-how-many-smart-pointer-classes-does-qt-have" rel="nofollow noreferrer">insightful article</a>, one of the Qt programmers tries to explain the different kinds of smart pointers Qt implements. In the beginning, he makes a distinction between sharing data and sharing the pointers themselves:</p>
  
  <blockquote>
    <p>First, let’s get one thing straight:
    there’s a difference between sharing
    pointers and sharing data. When you
    share pointers, the value of the
    pointer and its lifetime is protected
    by the smart pointer class. In other
    words, the pointer is the invariant.
    However, the object that the pointer
    is pointing to is completely outside
    its control. We don’t know if the
    object is copiable or not, if it’s
    assignable or not.</p>
    
    <p>Now, sharing of data involves the
    smart pointer class knowing something
    about the data being shared. In fact,
    the whole point is that the data is
    being shared and we don’t care how.
    The fact that pointers are being used
    to share the data is irrelevant at
    this point. For example, you don’t
    really care how Qt tool classes are
    implicitly shared, do you? What
    matters to you is that they are shared
    (thus reducing memory consumption) and
    that they work as if they weren’t.</p>
  </blockquote>
  
  <p>Frankly, I just don't undersand this explanation. There was a clarification plea in the article comments, but I didn't find the author's explanation sufficient.</p>
  
  <p>If you <em>do</em> understand this, please explain. What is this distinction, and how are other shared pointer classes (i.e. from boost or the new C++ standards) fit into this taxonomy?</p>
  
  <p>Thanks in advance</p>