associative arrays

Jonathan M Davis jmdavisProg at
Sun Jan 8 05:40:27 PST 2012

On Sunday, January 08, 2012 14:24:32 simendsjo wrote:
> Thanks for your clarifications.
> Does this mean even this is undefined?
> aa["a"] = new C();
> auto c = "a" in aa;
> aa["b"] = new C();
> // Using c here is undefined as an element was added to aa

Yes. Depending on the current implementation of AAs and the state of aa when 
"b" is added to it, c could still point to exactly what it did before, or aa 
could have been rehashed, which could move any or all of its elements around, 
in which case who knows what c points to.

- Jonathan M Davis

More information about the Digitalmars-d-learn mailing list