Boost logo

Boost :

Subject: Re: [boost] [utility] new auto_buffer class --- RFC
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-03-02 09:16:06

Cory Nelson skrev:
> On Mon, Mar 2, 2009 at 4:35 AM, Thorsten Ottosen
> <thorsten.ottosen_at_[hidden]> wrote:
>> Steven Watanabe skrev:
>>> AMDG
>>> Mathias Gaunard wrote:
>>>> Thorsten Ottosen wrote:
>>>>> Basically boost::auto_buffer<T,N> is a C++ version of variable lenght
>>>>> array (from C99).
>>>> N is known at compile-time.
>>>> Thus I do not see how it is related to C99 VLAs at all.
>>> N is not the number of elements in the container. N controls how much
>>> stack storage is allocated. The number of elements is dynamic.
>> Exactly.


> I think that sounds very useful. I'd be interested in seeing
> something like that in boost. But it's not anything like C99 VLAs, I
> wouldn't refer to it as such.

Well, AFAIK, they are very similar. You set the capacity once when you
initialize am object:

   boost::auto_buffer<T> buffer( get_max_capacity_from_somewhere() );

isn't that exactly what you do with VLAs?


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