Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2004-08-27 09:32:29

On Aug 27, 2004, at 9:08 AM, Bronek Kozicki wrote:

> 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.

I can see the utility of something like this. Perhaps we are talking
about two different kinds of smart pointers, neither inherently better
than the other. Sometimes you need hatchet, sometimes you need a
carving knife.


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