In fact, returning a
tr1::shared_ptr makes it possible for an interface designer to prevent a host of other client errors regarding resource release, because, as Item 14 explains,
tr1::shared_ptr allows a resource-release function — a “deleter” — to be bound to the smart pointer when the smart pointer is created.
- 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 also can have a custom deleter, but it becomes part of the type.
Share this highlighthttp://www.safaribooksonline.com/a/effective-c-55/2336752/