Empty associative array
Steven Schveighoffer
schveiguy at gmail.com
Mon Aug 9 16:15:56 UTC 2021
On 8/9/21 8:16 AM, deadalnix wrote:
> There is an immediate problem with this: how does one gets an empty, but
> non null, associative array?
There isn't a "good" way to do this. The only way I know is:
```d
a1[0] = 0;
a1.clear();
```
This will leave an empty, but allocated AA.
It would be pretty trivial to add this feature (make me an empty but
allocated AA). Probably 2 lines of code in druntime. People have tried
in the past to allow reserving memory for an AA, but it's not a trivial
task (unlike this).
I think there is an issue report somewhere, let me see... No didn't find
one.
-Steve
More information about the Digitalmars-d
mailing list