summaryrefslogtreecommitdiff
path: root/src/dynamic-array.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dynamic-array.hpp')
-rw-r--r--src/dynamic-array.hpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/dynamic-array.hpp b/src/dynamic-array.hpp
index 06479db..900a684 100644
--- a/src/dynamic-array.hpp
+++ b/src/dynamic-array.hpp
@@ -28,16 +28,16 @@ struct DynArray: DynArrayBase {
DynArray &operator=(const DynArray<T> &other);
DynArray &operator=(DynArray<T> &&other);
~DynArray();
- T &operator[](std::size_t index);
+ T &operator[](int64_t index);
T *GetPtr();
- const int64_t Count();
+ int64_t Count() const;
bool Has(const T &val);
template <typename T2>
int64_t FindFirstIndex(bool fn(const T&, const T2&), const T2 &val);
T& Push();
void Push(const T &val);
T Pop();
- void Remove(std::size_t index, int64_t count = 1);
+ void Remove(int64_t index, int64_t count = 1);
void Reserve(int64_t count);
void Resize(int64_t count);
protected:
@@ -115,10 +115,10 @@ 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[](int64_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");
- assert(index < 0xF000000000000000 && "Invalid DynArray<T>[] index - unlikely value");
+ assert(index >= 0 && "Invalid DynArray<T>[] index - unlikely value");
return *reinterpret_cast<T *>((this->ptr + (sizeof(T) * index)));
}
@@ -126,7 +126,7 @@ template <typename T> inline T *DynArray<T>::GetPtr() {
return reinterpret_cast<T *>(reinterpret_cast<void *>(this->ptr));
}
-template <typename T> inline const int64_t DynArray<T>::Count() {
+template <typename T> inline int64_t DynArray<T>::Count() const {
return this->elementCount;
}
@@ -180,7 +180,7 @@ template <typename T> inline T DynArray<T>::Pop() {
return *reinterpret_cast<T *>((this->ptr + (sizeof(T) * this->elementCount)));
}
-template <typename T> inline void DynArray<T>::Remove(std::size_t index, int64_t count) {
+template <typename T> inline void DynArray<T>::Remove(int64_t index, int64_t count) {
assert(index <= this->elementCount && "Invalid DynArray<T>::Remove() - Out of bounds");
int64_t moveCount = (this->elementCount - index - count);
assert(moveCount >= 0 && "Invalid DynArray<T>::Remove() - Removing too many elements");