O'Reilly logo
  • Ben Medina thinks this is interesting:

a better interface decision would be to preempt the problem by having the factory function return a smart pointer in the first place

From

Cover of Effective C++: 55 Specific Ways to Improve Your Programs and Designs, Third Edition

Note

unique_ptr should be the default for factory function returns. You can turn one into a shared_ptr if needed, but if not, you don’t force the overhead of ref counting on all clients.