title: Difference between foo = bar and foo{ bar }
body: <p>I was under the impression that <code>foo = bar</code> and <code>foo{ bar }</code> both did the same thing and it was just a matter of preference, but in my code <code>foo = bar</code> gives an error but <code>foo{ bar }</code> does not:</p>
  <pre><code>std::vector&lt;std::unique_ptr&lt;bar&gt;&gt; bars;
  
  bar&amp; myFunction() {
  
      bar* b = new bar();
      std::unique_ptr&lt;bar&gt; foo{ b }; //works fine
      std::unique_ptr&lt;bar&gt; foo = b; //error
      bars.emplace_back(std::move(foo));
  
      return *b;
  
  }
  </code></pre>
  <p>Any idea why this is happening?</p>