Boost logo

Boost :

Subject: Re: [boost] Interest check: container with preallocated buffer
From: Brian Wood (woodbrian77_at_[hidden])
Date: 2009-05-19 16:41:47


Thorsten Ottosen writes:
>>Dmitry Vinogradov skrev:
>> Boost.Array offers constant size container with preallocated buffer,
>> Boost.Optional provides from zero to one element. There are no STL
>> container with preallocated buffer and it seems custom allocator does
>> not help to do this with existing containers.
>>
>> Does any container exist to offer functionality like Boost.Array but
>> allowing to store from 0 to N elements? Is there any interest in such
>> container?
>>
>> PS. It's similar to fixed_string but as a generic container.
>Please see
>http://www.cs.aau.dk/~nesotto/boost/auto_buffer.zip
>http://www.cs.aau.dk/~nesotto/boost/trunk/libs/auto_buffer/doc/html/
>

I was looking at the documentation and the Serialization and "Differences
from
std::vector<T>" pages were both empty. It would be nice to indicate there's
nothing there yet for those pages.

On the Semantics page is says:

auto_buffer( const auto_buffer& r );

   - *Effect:* Copy constructor.
   - *Postconditions:* capacity() == max(r.size(),N) && size() == r.size() .

   - *Throws:* Nothing if size() <= N and the copy constructor of T cannot
   throw. Otherwise this might throw exceptions from the allocator of from T's
   copy constructor.

I think there's a typo in the last sentence there.

-- 
Brian Wood
Ebenezer Enterprises
www.webEbenezer.net
"Then Samuel took a rock and set it up between
Mizpah and Shen.  He named it Ebenezer [Rock of
Help] and said, 'Until now the LORD has helped us.'"

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