Edit: Ignore this comment.  I shouldn&#x27;t talk so much about something I use so little.  Somehow I skimmed through <a href="http:&#x2F;&#x2F;en.cppreference.com&#x2F;w&#x2F;cpp&#x2F;memory&#x2F;shared_ptr&#x2F;shared_ptr" rel="nofollow">http:&#x2F;&#x2F;en.cppreference.com&#x2F;w&#x2F;cpp&#x2F;memory&#x2F;shared_ptr&#x2F;shared_pt...</a> and thought that shared_ptr( const shared_ptr&amp; r ); was missing.<p>&gt;&gt; That&#x27;s a good point.  If the function will eventually lead to some object retaining a reference, then you should use a non-const shared_ptr ref.  The assignment into the object will do the copy constructor and that needs a non-const ref.  But, you don&#x27;t need to be making temp object copies along the way.  If the function will not lead to something retaining a reference, then you shouldn&#x27;t be passing the reference retention object to it.  Just pass a direct ref to the target object.