title: When should I return by value, as opposed to returning a unique pointer
body: <p>What I'm wondering is, how does returning by value a <code>Cat</code> actually differ from returning an <code>std::unique_ptr&lt;Cat&gt;</code> in terms of passing them around, memory management and using them in practice.</p>
  
  <p>Memory management wise, aren't they the same? As both a returned by value object and an object wrapped in a unique_ptr will have their destructors triggered once they go out of scope?</p>
  
  <p>So, how would you compare both pieces of code:</p>
  
  <pre><code>Cat catFactory(string catName) {
      return Cat(catName);
  }
  
  std::unique_ptr&lt;Cat&gt; catFactory(string catName) {
      return std::unique_ptr(new Cat(catName));
  }
  </code></pre>