Boost logo

Boost :

Subject: Re: [boost] Proposal: Monotonic Containers
From: joaquin_at_[hidden]
Date: 2009-06-09 09:34:21


Stewart, Robert escribió:
> Andrew Sutton wrote:
> On Tuesday, June 09, 2009 9:07 AM
>
>>> People will expect that a monotonic::foo<..> is like a
>>> foo<..>, and they will accept that it requires a storage
>>> argument. But they will find it harder to accept that it
>>> requires retooling from a type-argument level of the
>>> allocator.
>>>
>> Why incur the overhead of expectation, when foo<T,
>> monotonic::allocator<T>> gives you exactly what you want?
>>
>
> There's a problem with using an allocator for the node based containers: they
> use the allocator to allocate the elements but not the nodes. That implies
> free store (de)allocations for the nodes which is contrary to the intended
> purpose of this proposal.
>

Umm, I beg to differ. If we have a node-based container

  xxx<T,...,custom_allocator<T> >

and node<T> is the internal node type, the container is required
to do the allocation using an allocator of type

  custom_allocator<T>::rebind<node<T> >::other.

The container is not allowed to do any kind of allocation using
other means than the custom_allocator<X> family of allocators.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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