title: std::shared_ptr: reset() vs. assignment
body: <p>This is a basic question, but I did not find a previous post about it. The title of the following question sounds like it might be the same question as mine, but the question itself does not match the title: <a href="https://stackoverflow.com/questions/14836691/is-it-better-to-use-shared-ptr-reset-or-operator">is it better to use shared_ptr.reset or operator =?</a></p>
  
  <p>I am confused about the purpose of the <code>reset()</code> member function of <code>std::shared_ptr</code>: what does it contribute in addition to the assignment operator?</p>
  
  <p>To be concrete, given the definition:</p>
  
  <pre><code>auto p = std::make_shared&lt;int&gt;(1);
  </code></pre>
  
  <ol>
  <li><p>Are the following two lines equivalent:</p>
  
  <pre><code>p = std::make_shared&lt;int&gt;(5);
  p.reset(new int(5));
  </code></pre></li>
  <li><p>What about these:</p>
  
  <pre><code>p = nullptr;
  p.reset();
  </code></pre></li>
  </ol>
  
  <p>If the two lines are equivalent in both cases, then what is the purpose of <code>reset()</code>? </p>
  
  <hr>
  
  <p>EDIT: Let me re-phrase the question to better emphasize its point. The question is: is there a case where <code>reset()</code> lets us achieve something that is not as easily achievable without it?</p>