From: David Abrahams (dave_at_[hidden])
Date: 2004-08-27 09:22:51
Bronek Kozicki <brok_at_[hidden]> writes:
> David Abrahams wrote:
>> Bronek Kozicki <brok_at_[hidden]> writes:
>>>Howard Hinnant wrote:
>>>>template<class T, class D = typename detail::default_delete<T>::type>
>>>why in type? This could be stored in trampoline function, stored
>>>together with pointer, something like this
>> 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.
Believe me, I'm aware of the advantages of having a deleter member.
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk