Provide the deleter.
It clears up any confusion about how the user is supposed to delete the object (delete
? free
(it comes from an extern "C"
call after all)?)
And what's more, in some versions of Visual Studio, the way the runtime library works may, depending on the compiler options, mean that you cannot delete
an object in one module that was new
ed in another.
Better than either option, though (IMO): return a shared_ptr
that you already initialized with an appropriate deleter.