diff options
Diffstat (limited to 'src/dynamic-array.hpp')
| -rw-r--r-- | src/dynamic-array.hpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dynamic-array.hpp b/src/dynamic-array.hpp index ddcc8b4..1c99b4c 100644 --- a/src/dynamic-array.hpp +++ b/src/dynamic-array.hpp @@ -22,7 +22,7 @@ struct DynArray: DynArrayBase { DynArray(); explicit DynArray(int64_t reserveCount); ~DynArray(); - T operator[](std::size_t index); + T &operator[](std::size_t index); T *GetPtr(); const int64_t Count(); bool Has(const T &val); @@ -54,7 +54,7 @@ template <typename T> inline DynArray<T>::~DynArray() { DynArrayDestroy(this); } -template <typename T> inline T DynArray<T>::operator[](std::size_t index) { +template <typename T> inline T &DynArray<T>::operator[](std::size_t index) { assert(index < this->elementCount && "Invalid DynArray<T>[] index - out of bounds"); assert(index < this->reservedCount && "Invalid DynArray<T>[] index - out of reserved bounds"); return *reinterpret_cast<T *>((this->ptr + (sizeof(T) * index))); |
