title: How can a unique_ptr be returned by value without std::move?
body: <pre><code>std::unique_ptr&lt;int&gt; ptr() {
      std::unique_ptr&lt;int&gt; p(new int(3));
      return p;  //  Why doesn't this require explicit move using std::move?
  }  // Why didn't the data pointed to by 'p' is not destroyed here though p is not moved?
  
  int main() {
      std::unique_ptr&lt;int&gt; a = ptr();  // Why doesn't this require std::move? 
      std::cout &lt;&lt; *a; // Prints 3.
  }
  </code></pre>
  
  <p>In the above code, the function <code>ptr()</code> returns a copy of <code>p</code>. When <code>p</code> goes out of scope, the data '3' should get deleted. But how does the code work without any access violation? </p>