Polymorphic procedure, with passed in compile time type but without removing the type in params etc.
This commit is contained in:
@@ -54,6 +54,24 @@ struct Array {
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void insert(T item, int index) {
|
||||
if (index == len) {
|
||||
add(item);
|
||||
return;
|
||||
}
|
||||
|
||||
assert(index < len);
|
||||
assert(index >= 0);
|
||||
|
||||
grow(1);
|
||||
int right_len = len - index;
|
||||
memmove(data + index + 1, data + index, sizeof(T) * right_len);
|
||||
data[index] = item;
|
||||
len += 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
void add(T item) {
|
||||
grow(1);
|
||||
data[len++] = item;
|
||||
@@ -113,14 +131,6 @@ struct Array {
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
CORE_Static Array<T>
|
||||
array_make(Allocator *a, S64 size = 16) {
|
||||
Array<T> result = {};
|
||||
result.init(a, size);
|
||||
return result;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Map
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user