title: If I take a raw pointer of a unique_ptr and then use reset, is the raw pointer still guaranteed to be valid?
body: <p>Eg I'm pretty sure this works.</p>
  
  <pre><code>int foo = 51;
  int* bar = &amp;foo;
  foo = 3;
  </code></pre>
  
  <p>So bar is still valid, and <code>*bar == 3</code>.</p>
  
  <p>What about if we say</p>
  
  <pre><code>std::unique_ptr&lt;int&gt; foo(new int(51));  // should probably use make_unique
  int* bar = foo.get();
  foo.reset(new int(3));
  </code></pre>
  
  <p>Am I guaranteed that <code>*bar == 3</code>?
  Or am I causing undefined behavior by continuing to reference bar?</p>