$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [utility] new auto_buffer class --- RFC
From: Christopher Jefferson (chris_at_[hidden])
Date: 2009-03-02 17:57:45
On 2 Mar 2009, at 21:32, Thorsten Ottosen wrote:
> 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.
>
Interesting, I wouldn't have expected to get such a big difference. I  
certainly have no trouble with a push_back_unchecked(), but think  
push_back() should do what it does in vector and friends.
Chris