In my previous entry, C++ RAII adapter for Xerces, I presented a simple memory management wrapper for Xerces types. Because of the way Xerces manages memory, I said, the quite handy boost::shared_ptr
couldn’t be used, so I wrote the memory management code myself to produce a safe wrapper in the style of std::auto_ptr
.
However, as Alf P. Steinbach pointed out, I was wrong, in that boost::shared_ptr
could be used by taking advantage of the custom deleter facility offered by that class. One benefit is that I can get rid of my hand-rolled memory management, but on the other hand, I’ll have to adjust the public interface to reflect different semantics.