Has AA a bad implementation?

frame frame86 at live.com
Fri Feb 12 12:41:32 UTC 2021


Talking about this:

aaA.d: 157
> void clear() pure nothrow
> {
>    import core.stdc.string : memset;
>    // clear all data, but don't change bucket array length
>    memset(&buckets[firstUsed], 0, (buckets.length - firstUsed) 
> * Bucket.sizeof);
>    deleted = used = 0;
>    firstUsed = cast(uint) dim;
> }

I see this is for performance but it also means that an 
associative array never frees the memory it has allocated for 
life time - or I'm wrong? I am missing a real empty() method here.


More information about the Digitalmars-d mailing list