Does associative array change the location of values?

Stanislav Blinov stanislav.blinov at
Sat Oct 30 20:05:17 UTC 2021

On Saturday, 30 October 2021 at 18:31:16 UTC, Andrey Zherikov 

> I did small test and it printed the same values three times so 
> even rehash doesn't change the address of the value:

> So it seems pretty safe to store a pointer to a value in AA. 
> And I agree that this should definitely be documented.

Address itself may change though. While the AA won't move stuff 
around, a GC might. I don't think current GC moves anything, but 
it's definitely allowed to. Which would be transparent to your 
code so long as you don't depend on the value of address itself :)

More information about the Digitalmars-d-learn mailing list