title: Embedded reference count with Boost shared_ptr
body: <p>I love Boost's smart_ptr features and the ability to convert to and from a <code>shared_ptr</code> and <code>weak_ptr</code>, but since the reference count is not contained in the pointed class itself, the following code does not work (and it shouldn't).</p>
  
  <pre><code>A *a = new A;
  shared_ptr&lt;A&gt; aPtr1(a);
  
  {
      shared_ptr&lt;A&gt; aPtr2(a);
  
      // The reference counts of aPtr1 and aPtr2 are both 1.
  }   // At this point, `a` is destructed by aPtr2.
  
  aPtr1-&gt;foo();   // And... SIGTERM
  </code></pre>
  
  <p>I believe the <a href="http://www.rawmaterialsoftware.com/about.php" rel="nofollow">JUCE</a> framework has this functionality. [<a href="http://www.rawmaterialsoftware.com/juce/api/classReferenceCountedObject.html" rel="nofollow"><code>ReferenceCountedObject</code></a> and <a href="http://www.rawmaterialsoftware.com/juce/api/classReferenceCountedObjectPtr.html" rel="nofollow"><code>ReferenceCountedObjectPtr</code></a>]
  However, I'd rather use Boost for my application. Is it possible to allow Boost smart_ptrs to look for the reference count in the pointed class rather than the private <code>boost::detail::shared_count</code> instance?</p>