
On Mon, Mar 2, 2009 at 3:59 PM, Thorsten Ottosen <thorsten.ottosen@dezide.com> wrote:
Felipe Magno de Almeida skrev:
[snip]
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 how small.
And then there is the additional check for buffer expansion.
I would think this check would be quite unexpensive. [snip]
-Thorsten
Regards, -- Felipe Magno de Almeida