Hash Tables in D

Minas Mina via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sun Jan 3 23:09:30 PST 2016


On Sunday, 3 January 2016 at 19:29:05 UTC, Martin Nowak wrote:
> On 01/01/2016 04:27 PM, Minas Mina wrote:
>> On Friday, 1 January 2016 at 13:59:35 UTC, Walter Bright wrote:
>>> http://minas-mina.com/2016/01/01/associative-arrays/
>>>
>>> https://www.reddit.com/r/programming/comments/3z03ji/hash_tables_in_the_d_programming_language/
>>>
>> 
>> Thanks for sharing this. I am the author. :)
>
> There is a bug.
>
> You should never do this b/c of iterator/range invalidation.
>
> foreach (key; aa.keys)
>     aa.remove(key);

The reference states that keys: "Returns dynamic array, the 
elements of which are the keys in the associative array".

Isn't the array newly allocated?


More information about the Digitalmars-d-announce mailing list