diff options
Diffstat (limited to 'src/dynamic-array.hpp')
| -rw-r--r-- | src/dynamic-array.hpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dynamic-array.hpp b/src/dynamic-array.hpp index 3bf02ee..fa1e665 100644 --- a/src/dynamic-array.hpp +++ b/src/dynamic-array.hpp @@ -141,7 +141,9 @@ template <typename T> inline T &DynArray<T>::Push() { DynArrayReserve(this, int64_t(safeReserveCount * 1.5)); } auto itemPtr = this->ptr + (sizeof(T) * this->elementCount); - const auto &targetItem = new(itemPtr) T{}; + if IS_CONSTRUCTIBLE(T) { + new (itemPtr) T{}; + } this->elementCount += 1; return *reinterpret_cast<T *>(itemPtr); } |
