Subject: Re: [boost] [utility] auto_buffer v2
From: Amit (contact.lipik_at_[hidden])
Date: 2009-10-07 08:28:46
Thorsten Ottosen <thorsten.ottosen <at> dezide.com> writes:
> Dear All,
> Hereby an updated class. Thanks to all who contributed with comments to
> the first try.
I just downloaded the latest version from http://www.cs.aau.dk/~nesotto/boost/
A quick visual inspection appears to indicate that the sign of the
inequality in uninitialized_grow() is wrong - i.e. it should be:
pointer uninitialized_grow( size_type n ) // strong
if( size_ + n > members_.capacity_ )
reserve( size_ + n );
Also, when I actually use it, I keep having to write:
because the size constructor only appears to reserve, and not resize -
perhaps it can take a boolean, with default set to reserve and resize?
Similar problem with resize etc - the natural interface always initializes,
which is almost never what you want from a buffer class - 99% of the time
you want a buffer to write into.
So maybe it might be worth considering changing the interface so the
default members all resize uninitialized, and have checked_resize() etc
for uncommon cases?