Subject: Re: [boost] [utility] new auto_buffer class --- RFC
From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2009-03-02 14:17:03
On Mon, Mar 2, 2009 at 3:59 PM, Thorsten Ottosen
> Felipe Magno de Almeida skrev:
>> Can't push_back call reserve if it doesn't fit? That way push_back could
>> still be inlineable. Or am I missing something?
> Last I checked, vector<T>::push_back() was not inlined, no matter the
> optimization level. The whole involvement of the allocator, and copying
> of elements on expansion seems to tell the compile it is inadvisable.
I see, And auto_buffer::push_back is inlined?
Have you tried with the buffer expansion check?
I still advocate for a growing push_back even if it is not inlined, and
adding a unchecked_push_back if somebody needs more performance.
> And even if it was inlinable on compiler X, then what about compile Y?
I guess this can't really be enforced in a standard way anyway. No matter
> And then there is the additional check for buffer expansion.
I would think this check would be quite unexpensive.
-- Felipe Magno de Almeida
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk