summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qarraydataops.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qarraydataops.h')
-rw-r--r--src/corelib/tools/qarraydataops.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h
index 8e19525f07..0b967a84f7 100644
--- a/src/corelib/tools/qarraydataops.h
+++ b/src/corelib/tools/qarraydataops.h
@@ -65,8 +65,10 @@ struct QPodArrayOps
Q_ASSERT(newSize > uint(this->size));
Q_ASSERT(newSize <= this->alloc);
- ::memset(static_cast<void *>(this->end()), 0, (newSize - this->size) * sizeof(T));
- this->size = int(newSize);
+ T *const begin = this->begin();
+ do {
+ new (begin + this->size) T();
+ } while (uint(++this->size) != newSize);
}
void copyAppend(const T *b, const T *e)
@@ -154,7 +156,7 @@ struct QGenericArrayOps
T *const begin = this->begin();
do {
- new (begin + this->size) T;
+ new (begin + this->size) T();
} while (uint(++this->size) != newSize);
}