On Wed, Nov 25, 2015 at 08:24:24PM +0000, user-6431 via Digitalmars-d-learn wrote: > I know that AA items order does not follow the additions but is the > order deterministic ? > > For example for a given set of items, will they always be ordered in > the same way ? (I mean whatever is the way I append them to the AA).
It is deterministic in the current implementation, but this should not be relied on. A future implementation may change the order without any warning (e.g., upgrade druntime, and AA order becomes different from before). A future implementation may also return items in a different order each time you iterate the same AA (unlikely, but in theory possible). Generally, if you want any kind of ordering on your items, AA's are not a good container to use. A better container would be some kind of tree-based structure that has a guaranteed ordering. If you need the O(1) access speed of AA's but still want deterministic ordering, you could perhaps consider using the AA as an "index" into the actual container (say, an array or tree), so that individual lookups are fast, but when you need to iterate the entire set you have full control over the ordering. T -- Turning your clock 15 minutes ahead won't cure lateness---you're just making time go faster!