The documentation I have says that std::auto_ptr is deprecated, so I'm guessing that we're supposed to use shared_ptr now, even for unshared pointers. I see that shared_ptr supports custom deletion with functors, but the syntax of it makes it sort of difficult to 'shoehorn' that into a new type. In other words, does anyone know of a way to make a derived type from shared_ptr that uses a custom deleter of a set type? So I could say something like:
[source lang="cpp"]//This does not work because template syntax is stupid:template<class T> class Releaser { void operator()(T* p) { p->Release(); }};template<class T> class Releasable : public shared_ptr<T, Releaser>;Releasable<foo> bar(fooPtr); //will call fooPtr->Release(); on dtor[/source]
Edited by Khatharr, 27 November 2012 - 06:28 PM.






