Does associative array change the location of values?

Andrey Zherikov andrey.zherikov at gmail.com
Fri Oct 29 19:41:04 UTC 2021


On Friday, 29 October 2021 at 17:58:24 UTC, Paul Backus wrote:
> No, the AA does not guarantee that the value will remain in the 
> same location. Inserting or removing *any* keys could cause the 
> AA to resize, which may change the locations of all of its 
> values.
>
> However, you do not have to worry about undefined behavior, 
> because the garbage collector will keep the "stale" copy of the 
> value alive as long as you hold a pointer to it.

Thanks a lot for clarification


More information about the Digitalmars-d-learn mailing list