title: std::unique_ptr::reset and constructor exceptions
body: <p>If initialise a <code>unique_ptr</code> like this:</p>
  
  <pre><code>std::unique_ptr&lt;Foo&gt; i;
  i.reset( new Foo() ); 
  </code></pre>
  
  <p>but an exception is thrown from <code>Foo::Foo()</code>, the question is: what happens with the memory allocated? how does unique_ptr avoid it being leaked? is this something handled inside <code>new</code> operator?</p>
  
  <p>The destructor will certainly be called when the scope exits. Since the <code>reset</code> call is not invoked until <code>new Foo()</code> returns, it seems that this must be handled by <code>new</code>, by freeing the allocated memory when the exception leaves the constructor. </p>
  
  <p>Is that what happens?</p>