
David Abrahams wrote:
Bronek Kozicki <brok@rubikon.pl> writes:
Howard Hinnant wrote:
template<class T, class D = typename detail::default_delete<T>::type> class move_ptr;
why in type? This could be stored in trampoline function, stored together with pointer, something like this http://b.kozicki.pl/cpp/ext_auto_ptr_090.zip
It's a space-vs-time tradeoff.
right, but do you really believe that deleter should belong to type? Tradeoff is really small (3 pointers more, no extra allocations), and it gives *runtime* choice of deleter. Thus with it you can write "source" function (the one returning smart pointer), and caller of this function does not need to know anything about deleter. Heck, you can even safely pass pointers and other things between dynamic libraries, each using its own copy of statically linked CRT. B.