Remove array alloc, not a good idea
This commit is contained in:
@@ -471,29 +471,6 @@ void BoundedAddError(Array<T> *arr, T item) {
|
||||
if (arr->len + 1 <= arr->cap) arr->data[arr->len++] = item;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T *Alloc(Array<T> *arr, T item) {
|
||||
TryGrowing(arr);
|
||||
T *ref = arr->data + arr->len++;
|
||||
ref[0] = item;
|
||||
return ref;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T *Alloc(Array<T> *arr) {
|
||||
return Alloc(arr, {});
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T *AllocMultiple(Array<T> *arr, int64_t count, bool zero_memory = true) {
|
||||
TryGrowing(arr, count);
|
||||
T *result = arr->data + arr->len;
|
||||
arr->len += count;
|
||||
if (zero_memory)
|
||||
for (int64_t i = 0; i < count; i += 1) result[i] = {};
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Insert(Array<T> *arr, T item, int64_t index) {
|
||||
if (index == arr->len) {
|
||||
|
||||
Reference in New Issue
Block a user