
Felipe Magno de Almeida skrev:
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?
At least it is much more likely to be. Again, the standard doesn't guarantee it.
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.
Yes, but are needed.
And then there is the additional check for buffer expansion.
I would think this check would be quite unexpensive.
Yeah, probably small compared to the function not being inlined. But still an overhead we would like to avoid if possible. -Thorsten