Subject: Re: [boost] [utility] new auto_buffer class --- RFC
From: Christopher Jefferson (chris_at_[hidden])
Date: 2009-03-02 16:26:24
On 2 Mar 2009, at 20:12, Thorsten Ottosen wrote:
> Frank Mori Hess skrev:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>> On Monday 02 March 2009, Thorsten Ottosen wrote:
>>> Ok, but can you determine the size of the buffer in advance, so
>>> you can
>>> call reserve?
>> Yes. If you're proposing adding the ability to grow an
>> auto_buffer's capacity after it is constructed via a reserve()
>> call, I could live with that.
> No, I was actually advocating the that push_back should not grow.
> But as pointed out in another part of this thread, we need both cases.
> you will be able to use the latter, which is more efficient.
You could make exactly the same argument about pushing back into a
vector, why not have a push_back_unchecked that doesn't check if
reallocation must occur. I did once experiment with this and got no
measurable speed improvement.
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk