Fix bad loop count when inserting data into rdcarray

This commit is contained in:
baldurk committed 2018-07-24 15:51:31 +01:00
1 parent b08e9c76c0
commit df4458e6d0
2 files changed
+38 -1

No files matched your search

+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