Core: Vector::Insert allocation reserve reduced to 50%

git-svn-id: svn://ultimatepp.org/upp/trunk@5739 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2013-01-27 16:53:58 +00:00
parent bb5fbca76d
commit 8fd5e0e322

View file

@ -243,7 +243,7 @@ void Vector<T>::RawInsert(int q, int count)
ASSERT(q >= 0 && q <= items);
if(!count) return;
if(items + count > alloc) {
T *newvector = RawAlloc(alloc = alloc + ntl_max(alloc, count));
T *newvector = RawAlloc(alloc = max(alloc + count, int(alloc + ((unsigned)alloc >> 1))));
if(vector) {
memcpy(newvector, vector, q * sizeof(T));
memcpy(newvector + q + count, vector + q, (items - q) * sizeof(T));