mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-12 22:33:36 +00:00
File restructure (again)
This commit is contained in:
@@ -19,6 +19,7 @@ struct Array {
|
||||
};
|
||||
|
||||
template <typename T> void array_init (Array<T> *array, gbAllocator a, isize init_capacity = ARRAY_GROW_FORMULA(0));
|
||||
template <typename T> void array_init_count (Array<T> *array, gbAllocator a, isize count);
|
||||
template <typename T> Array<T> array_make (T *data, isize count, isize capacity);
|
||||
template <typename T> void array_free (Array<T> *array);
|
||||
template <typename T> void array_add (Array<T> *array, T const &t);
|
||||
@@ -37,6 +38,15 @@ void array_init(Array<T> *array, gbAllocator a, isize init_capacity) {
|
||||
array->capacity = init_capacity;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void array_init_count(Array<T> *array, gbAllocator a, isize count) {
|
||||
array->allocator = a;
|
||||
array->data = gb_alloc_array(a, T, count);
|
||||
array->count = count;
|
||||
array->capacity = count;
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
Array<T> array_make(T *data, isize count, isize capacity) {
|
||||
Array<T> a = {};
|
||||
|
||||
Reference in New Issue
Block a user