Proposal for std::vector.
Matt Austern
austern@apple.com
Fri Feb 6 18:58:00 GMT 2004
On Feb 6, 2004, at 9:45 AM, Stephen M. Webb wrote:
> On Friday, February 06 2004 12:19, Dhruv Matani wrote:
>> On Fri, 2004-02-06 at 20:58, Stephen M. Webb wrote:
>>>
>>> Deque is no less likely to use a stateless allocator than is vector.
>>
>> Yes agreed. However, if the object size for deque exceeds 512 bytes
>> (which is highly unlikely), the complexity of the iterators and the
>> extra space in the nodes would be an overkill. So, for normal
>> operation,
>> deque would call the allocate function with these values:
>
> [snip]
>
> In the general case a deque needs two allocators, one for its node
> list and
> one for its nodes. The allocation requirements of its node list
> allocator
> are different from those of its nodes. From which allocator should
> the deque
> itself derive? What do you do with the other allocator?
You either give it two base classes, or else you only inherit from one
and
then you use the converting constructor to get the other one when you
need it. I chose the latter, because I thought it was slightly
simpler. This
is what our implementation of std::deque currently does.
--Matt
More information about the Libstdc++
mailing list