I don't see how to get scoped_ptr or scoped_array to use custom deleter
You can not.
Perhaps there is another implementation that allows you to control deletion like shared_ptr ?
If your compiler supports rvalue references and the standard library implementation implements std::unique_ptr , you can use this.
Otherwise, the implementation of boost::scoped_ptr very simple. The latest version is less than 100 lines of simple code. It would be quite simple to create your own derivative that has a custom divider (either static using a template parameter, or dynamic via a function or functor provided at runtime).
James McNellis
source share