title: Copying the Contents of a boost::shared_ptr - is there a way?
body: <p>I want to copy the contents of a boost::shared_ptr I'm getting in a function</p>
  
  <pre><code>void virtual Add(const T_Value&amp; value)
      {           
          push_back(value);
          if (_limit != -1 &amp;&amp; int(size()) &gt; _limit)
              erase(begin());//,begin() + (_limit &gt;&gt; 1));
      }
  </code></pre>
  
  <p>Where T_Value is <code>boost::shared_ptr&lt;ValueType&gt;</code></p>
  
  <p>My problem is that with this method, obviously, the use_count of the <code>value</code> is incremented because it now has another reference within the std::list this function is part of.</p>
  
  <p>What I want, to do, however, is only copy the contents of <code>value</code> into a new shared_ptr, one with a new count, and insert it into the list.</p>
  
  <p>Thus, the use_count - at the end of the function (leaving the scope) would remain the original use_count of <code>value</code> for <code>value</code>; and a use_count of 1 for the new shared_ptr that will be inserted into the list.</p>