Boost logo

Boost :

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


Peter Dimov wrote:
>> 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
>
> So that sizeof(move_ptr<T>) can be the same as sizeof(T*).

No quite. You can have sizeof(move_ptr<T, &your_deleter_goes_here>) the
same size as sizeof(T*), but you need to "encode" deleter into smart
pointer type.

What about yet another smart opinter class that does *not* store deleter
info inside its type?

Or about providing specialization of move_ptr, that will have slightly
higher overhead and provide runtime selection of deleter, something like:

template <typename T>
class move_ptr<T, dynamic>
{
   // ... something similar to ext_auto_ptr_090 goes here
};

sizeof(move_ptr<T, dynamic>) == sizeof(move_ptr<T, &deleter>) * 4

B.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk