a better interface decision would be to preempt the problem by having the factory function return a smart pointer in the first place
- 4. Designs and Declarations
- from Effective C++: 55 Specific Ways to Improve Your Programs and Designs, Third Edition
- Publisher: Addison-Wesley Professional
- Released: May 2005
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.
Share this highlighthttp://www.safaribooksonline.com/a/effective-c-55/2336739/