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

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.


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


unique_ptr also can have a custom deleter, but it becomes part of the type.