Empties the array but keeps its storage, so refilling it up to the old capacity allocates nothing.
The elements are not touched or destroyed; if they own memory, free that first.
values: [..] int;
array_add(*values, 1, 2, 3);
capacity := values.allocated;
array_reset_keeping_memory(*values);
assert(values.count == 0 && values.allocated == capacity);
array_free(values);array_reset_keeping_memory :: (array: *[..] $T)
Empties the array but keeps its storage, so refilling it up to the old capacity allocates nothing.
The elements are not touched or destroyed; if they own memory, free that first.
Parameters
- array: *[..] $T
values: [..] int;
array_add(*values, 1, 2, 3);
capacity := values.allocated;
array_reset_keeping_memory(*values);
assert(values.count == 0 && values.allocated == capacity);
array_free(values);