diff options
| author | Tetralux <tetralux@teknik.io> | 2020-01-26 01:03:14 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-26 01:03:14 +0000 |
| commit | abe87898903853c5c57fc5e436025e19526e9b71 (patch) | |
| tree | 3dd1a43a67e032fa9797e37c2dd3bd50fb51ec0a /src/check_type.cpp | |
| parent | 14c4fed94ca0a401892409c6a4e8a018e65b0e4c (diff) | |
Fix `make(map[K]V, 0)` by ensuring `reserve` always sets an allocator
Currently, `make(map[K]V, 0)` asserts, because trying `reserve` zero items does not set the allocator; it early-outs.
`__dynamic_map_reserve` assumed that `__dynamic_array_reserve` would always set the allocator - even if given a desired capacity of `0`.
Rather than making `__slice_resize` just _also_ set the default allocator if there isn't one, this makes `__dynamic_array_reserve` always set the allocator, even if it is about to early out.
This is because users are lead to understand that `append` will set the allocator if one is not already set - `reserve` should work the same way.
Diffstat (limited to 'src/check_type.cpp')
0 files changed, 0 insertions, 0 deletions