Fix bad loop count when inserting data into rdcarray

This commit is contained in:
baldurk
2018-07-24 15:51:31 +01:00
parent b08e9c76c0
commit df4458e6d0
2 changed files with 38 additions and 1 deletions
+2 -1
View File
@@ -447,7 +447,8 @@ public:
// destruct it before inserting.
// first pass, copy
for(size_t i = 0; i < count; i++)
size_t copyCount = count < oldSize ? count : oldSize;
for(size_t i = 0; i < copyCount; i++)
new(elems + oldSize + count - 1 - i) T(elems[oldSize - 1 - i]);
// second pass, destruct & copy if there was any overlap