
Max Khesin wrote:
As of version 3.1 boost shared_ptr has a constructor that takes a user-defined deleter: template<class Y, class D> shared_ptr(Y * p, D d): px(p), pn(p, d) { detail::sp_enable_shared_from_this(p, p, pn); } Maybe I missed something, but what is your library adding to this?
His library can handle non-pointers that can't be stored directly in a shared pointer. Another possible example it to store sockets: scoped_handle<int> sock(::socket(AF_INET, SOCK_STREAM, 0), ::close); Something similar has been mentioned before, for example see: http://lists.boost.org/MailArchives/boost/msg49290.php I think there might have been talk of getting a policy base smart pointer to do this kind of thing as well. I guess that nothing much has happened yet because the need isn't that great. On the rare occasions that you need something like this, emulating it with smart pointers is usually good enough. And if it isn't, then it's not that hard to write it in a non-generic way. There aren't as many problems as writing a smart pointer. For example, you don't need to deal with the different operator overloads. Daniel