Boost logo

Boost :

Subject: Re: [boost] Interest in StaticVector - fixed capacity vector
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2011-10-16 06:08:29


Peter Dimov wrote:
> Dave Abrahams wrote:
>
>> In the wider use-cases why isn't "fall back to the heap" the right thing
>> to do?
>
> I've no idea. To avoid denial of service, perhaps. Or perhaps the
> processing code after that is limited to a specific size anyway for
> performance reasons, so it makes no sense to collect more values.

Why stick to this container? Why close this funcionality inside? You are
all of the time debating about one case which should be handled differently.

One should provide an adaptor which would work for all:

typedef std::vector<T> V;
typedef static_vector<T, N> SV;
// however I'd rather change the name for XXX_array

bounded_buffer<V, N> bounded_vector;
bounded_buffer<SV, N> bounded_XXX_array;
bounded_buffer<std::list<T>, N> bounded_list;
bounded_buffer<std::deque<T>, N> bounded_deque;

Regards,
Adam


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