Boost logo

Boost :

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


Christopher Jefferson skrev:
>
> 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.
>>
>> push_back()
>> push_back_unchecked()
>>
>> 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.

So did I in a real-time ray-tracing application. The difference was a
deal-breaker.

-Thorsten


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