Allocating an empty non null associative arary

Superstar64 Hexagonalstar64 at gmail.com
Tue Mar 31 13:41:32 UTC 2020


On Tuesday, 31 March 2020 at 06:51:16 UTC, WebFreak001 wrote:
> This doesn't only happen with null, you will notice that that 
> function will eventually not add anything if you only add 
> values. This is because by adding values you might reallocate 
> the map at some other place in memory and because it's not ref, 
> the caller won't have the map point to the new reference and 
> still only have the old data.

Is the D spec wrong then? It says that associative arrays have 
reference semantics. 
https://dlang.org/spec/hash-map.html#construction_and_ref_semantic



More information about the Digitalmars-d-learn mailing list