Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2004-02-02 22:23:10


On 02/02/2004 08:51 PM, David Abrahams wrote:
> Larry Evans <cppljevans_at_[hidden]> writes:
>
>
>>On 02/02/2004 10:32 AM, Javier Estrada wrote:
>>>How about custom allocators AND deleters?
[snip]
>>
>>But instead of placing two pointers(1 for allocator + 1 for deleter) why
>>not use a virtual function table for both? In other words, instead of
[snip]
>
> What's the point of storing an allocator? Once the storage for the
> deleter is allocated, a shared_ptr never needs to allocate again.
>
Good point. I can't think of a reason. However, the idea of using
a virtual function table instead of a deleter may have some future
advantages. If something other than just deletion needs to be done,
then making this other function an entry in the vft would save some
space. For example, in the auto_new class, only a vft ptr is needed
instead of both a deleter and pointer to the most derived class. I.e.

sp_counted_base_impl<P,D>::ptr
sp_counted_base_impl<P,D>::del

Maybe Javier knows more.


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