Boost logo

Boost :

Subject: Re: [boost] Interest in StaticVector - fixed capacity vector
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2011-10-13 16:46:14

El 12/10/2011 12:37, Stewart, Robert escribió:
> Christian Holmquist wrote:
>> boost::container::static_vector seems like a good addition,
>> maybe it can be reviewed for inclusion in upcoming
>> Boost.Containers.
> That certainly would be the simplest way to add it to Boost and seems like the right place for it. You just need to see if Ion is interested.

It's interesting but we need some consensus on several issues (If swap
is O(N), should it be provided?, unchecked functions? what to do when
there is no room for more elemnets?) and the implementation should
support movable types and other goodies from boost.Container.

One of the extensions I was thinking for Boost.Container was a fixed
capacity vector, and the solution I planned was reusing
boost::container::vector code, maybe with some extensions supporting a
pseudo-allocator. boost::container:: vector could treat this
pseudo-allocator specially and avoid storing a m_capacity or m_pointer
member to save some words. Then allocate() could implement the policy
(assert, throw, or just ignore).

There are more issues. Do we want to support some kind of StaticVector
compatible with shared memory? then we need to specify pointer and
const_pointer as those define the pointer type stored in iterators...

Anyway, I think that we could implement an approach similar to Howard's
stack_alloc quite easily, and get most benefits with a bit of size overhead.


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