Boost logo

Boost :

Subject: Re: [boost] [container] static_vector: fixed capacity vector update
From: Olaf van der Spek (ml_at_[hidden])
Date: 2013-01-22 05:46:54


On Mon, Jan 21, 2013 at 9:50 PM, Jeffrey Lee Hellrung, Jr.
<jeffrey.hellrung_at_[hidden]> wrote:
> I would expect sizeof( static_vector ) < sizeof( hybrid_vector ) (even with
> EBO used for storing the allocator in the latter case), as hybrid_vector
> needs to discriminate between using internal and using external storage.
> Additionally, this will sometimes necessitate more branching and/or
> indirection in hybrid_vector than in static_vector for the same operation.
> Well, really, that's all just a guess, I haven't actually gone and
> implemented each myself. And it's assuming that hybrid_vector< T, N,
> null_allocator<T> > isn't special-cased to behave like a
> static_vector<T,N>, because, at that point, now we're just arguing over
> names.

Given that hybrid functionality is desired too I think it makes sense
to provide it.
Then, if static vector really can't be provided efficiently as a case
of hybrid_vector could you implement static vector.

> I would expect sizeof( static_vector ) < sizeof( hybrid_vector )

> as hybrid_vector
> needs to discriminate between using internal and using external storage.

That's just a single bit.

Olaf


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