diff options
| author | Tetralux <tetraluxonpc@gmail.com> | 2022-05-08 17:18:13 +0000 |
|---|---|---|
| committer | Tetralux <tetraluxonpc@gmail.com> | 2022-06-04 23:29:47 +0000 |
| commit | fa2296a124d0828adf2d3350b827be3f022d02be (patch) | |
| tree | 90058bd17a0183fcb3d55ee03b22598244c1a7b4 /src/main.cpp | |
| parent | 174fa9b490f450207fccf0f8d988afd8f27812a9 (diff) | |
[runtime] Add builtin `shrink` for dynamic arrays and maps
Asks the allocator to shrink the backing allocation to the current __length__, or a capacity
of the user's choosing.
Returns `(did_shrink: bool, err: mem.Allocator_Error)`.
```
shrink(&array) // shrinks to len(array)
shrink(&array, N) // shrink to N capacity
shrink(&map) // shrinks down to len(map)
shrink(&map, N) // shrink to N capacity
```
Diffstat (limited to 'src/main.cpp')
0 files changed, 0 insertions, 0 deletions