Boost logo

Boost :

From: Gregory Colvin (gregory.colvin_at_[hidden])
Date: 2003-09-02 16:28:41


On Tuesday, Sep 2, 2003, at 15:00 America/Denver, David Abrahams wrote:
> Gregory Colvin <gregory.colvin_at_[hidden]> writes:
>
>>> Also, if shared_ptr only needs to allocate at construction time (I'm
>>> not sure of this) we can avoid storing the allocator at all.
>>
>> Then how to deallocate?
>
> Using the custom deleter?

Which will need to store a copy of the allocator, unless one
takes advantage of the weasel wording that lets you instantiate
a new one for the purpose.

>>>> ...
>>> It still doesn't make any sense to
>>> return a T* from allocate since normally with a non-singular T* p,
>>> either p == 0 or *p refers to a constructed T.
>>
>> The idea was that Allocator<T>::pointer might be a proxy type
>> that cannot be converted to void* and back, so allocate() must
>> return and construct() must take an Allocator<T>::pointer rather
>> than a void*.
>
> Wow, creepy.

Yes. But unless you grant the desire to support such creepy
beasts then not much of Allocator makes any sense. And such
beasts can do useful work, like persistent stores and shared
memory.


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