Boost logo

Boost :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2004-08-27 08:08:52

David Abrahams wrote:
> Bronek Kozicki <brok_at_[hidden]> 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
> 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.


Boost list run by bdawes at, gregod at, cpdaniel at, john at