Can the order in associative array change when keys are not midified?

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 1 16:55:59 PST 2015


On Thu, 01 Jan 2015 12:32:33 +0000
Idan Arye via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:

> If I have an associative array and I only modify it's values, 
> without changing the keys, can I assume that the order won't 
> change?
please, don't: this is implementation-specific. druntime code can
change (for example, by tracking access frequency and regrouping
frequently accesed keys into clusters for better cache utilising), and
your finely crafted code will start to fail mysteriously.

it is safe to assume that after ANY change in AA *everything* is
changed there. you'd better augment AA with some "change buffer" or use
different data structure for your task.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150102/c3c599d5/attachment.sig>


More information about the Digitalmars-d-learn mailing list