Boost logo

Boost Users :

Subject: Re: [Boost-users] Is there a boost equivalent of eastl::fixed_vector?
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2008-09-24 08:15:50


dariomt_at_[hidden] wrote:
> In EASTL
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html there
> is something like SSO (Small String Optimization) applied to std::vector
> (and other STL containers)
>
> [begin quote]
> "Fixed containers are fixed-size containers with their memory stored
> right within the container itself. Fixed containers allocate no dynamic
> memory and their memory tends to be cache-friendly due to its contiguity
> and proximity to the container's housekeeping data. The user declares
> the max container size as a template parameter, and can also specify
> that if the container overflows that an auxiliary dynamic allocator is used.
>
> template <typename T, size_t nodeCount, bool enableOverflow = true,
> typename Allocator overflowAllocator = EASTLAllocator>
> class fixed_vector
> {
> ...
> };
>
> [end quote]
>
> I have tried a similar approach using some sort of
> fixed_buffer_with_overflow allocator, with no success. I'm not sure SSO
> is even possible just using an allocator with the standard containers,
> because I always end up with stateful allocators.
>
> So my question is if there is something similar already in boost.

Doesn't std::vector::reserve already give the "overflow" behavior -
albeit without the small string optimization? For non-"overflow" ability
there's boost::array.

Jeff


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net