Boost logo

Boost :

Subject: Re: [boost] [containers] Are there flat_map/set and stable_vector proposals at work?
From: Rob Stewart (robertstewart_at_[hidden])
Date: 2013-10-24 05:16:55

On Oct 23, 2013, at 11:57 AM, Klaim - Joël Lamotte <mjklaim_at_[hidden]> wrote:

> On Wed, Oct 23, 2013 at 5:07 PM, TONGARI J <tongari95_at_[hidden]> wrote:
>> I wonder if we can choose the underlying container for flat_xxx, for example, use deque instead of vector.
>> Or would it be better to make them as adaptors?
> That would be a different question for the container implementor.

It can, and possibly should, be in the hands of the user. After all, one selects flat_map over map, for example, for performance reasons.

> Experience shows that having the implementation type as a parameter is rarely a good idea.
> Having a vector as implementation is far enough for me right now but I don't really care as long as the flat_* behaviour and performance are
> similar.

Is that general experience, or just yours?

> I'm not sure what a deque would enable in this case.

The same things deque offers over vector normally: VM-friendly allocations and growth at front and back without copying.

If one reserves enough space up front, there's benefit in vector. If allocating on demand, deque can be better.


(Sent from my portable computation engine)

Boost list run by bdawes at, gregod at, cpdaniel at, john at