title: should assign `nullptr` to `std::unique_ptr` before assigning a new value to it?
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;memory&gt;
  using namespace std;
  
  int main() {
      std::unique_ptr&lt;int&gt; ptrA = std::make_unique&lt;int&gt;(10);
  
      ptrA = std::make_unique&lt;int&gt;(20); // case I
  
      return 0;
  }
  
  
  #include &lt;iostream&gt;
  #include &lt;memory&gt;
  using namespace std;
  
  int main() {
      std::unique_ptr&lt;int&gt; ptrA = std::make_unique&lt;int&gt;(10);
  
      ptrA = nullptr;                  // case II or ptrA.reset()
      ptrA = std::make_unique&lt;int&gt;(20);
  
      return 0;
  }
  </code></pre>
  
  <p>I have seen many people use <code>Case II</code>. However, <code>std::unique_ptr</code> is a smart pointer, I don't think we should assign either <code>nullptr</code> or call <code>reset</code> before reassigning a new value to it.</p>
  
  <p>Please correct me if I am wrong here.</p>