Boost logo

Boost Users :

Subject: Re: [Boost-users] Is there a boost equivalent of eastl::fixed_vector?
From: Mojmir Svoboda (mojmir.svoboda_at_[hidden])
Date: 2008-09-24 09:04:28


hello,

well if you are using words like "fixed-size" and "allocate no dynamic
memory" then boost::array<T,N> is your candidate, isn't it?

personally i miss the stored count of objects so i can push_back until
some capacity. so i modified the source slightly for these purposes.

regards,
mojmir

* dariomt_at_[hidden] <dariomt_at_[hidden]> [2008-09-24 11:32:45 +0200]:

> In EASTL http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.htmlthere
> 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.
>
> TIA

> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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