Boost logo

Boost :

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


Matt Calabrese skrev:
> On Mon, Mar 2, 2009 at 6:11 PM, Scott McMurray <me22.ca+boost_at_[hidden]>wrote:
>
>> It seems to me that if you need unchecked, then the class shouldn't be
>> storing the capacity at all (outside of debug versions), as it's
>> unnecessary overhead, which suggests to me that it would be the domain
>> of a separate, obviously unsafe class (unchecked_vector?).
>
>
> True, or behavior could be specified by a template argument -- one
> instantiation has a static max_size() function that yields the appropriate
> value based on the N argument and has an unsafe, unchecked push_back, the
> other is more flexible/safe and behaves more similarly to vector.

We can't really implement a growing push_back() or reserve() without a
capacity.

I think static_auto_buffer<T,N> where T is a POD might fill a small
niche. So I can provide both classes.

-Thorsten


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