Re: ordered Associative array

2017-04-13 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Apr 14, 2017 at 12:29:34AM +, Jethro via Digitalmars-d-learn wrote: > Is there a way to retain the ordering of an associative array? When > the elements are added then looped over using a foreach, the order is > different. An AA is implemented as an unordered hash. So the insertion ord

Re: ordered Associative array

2017-04-13 Thread solidstate1991 via Digitalmars-d-learn
On Friday, 14 April 2017 at 00:29:34 UTC, Jethro wrote: Is there a way to retain the ordering of an associative array? When the elements are added then looped over using a foreach, the order is different. Use a separate array to store the keys, order them all time when you add a new one, etc.

ordered Associative array

2017-04-13 Thread Jethro via Digitalmars-d-learn
Is there a way to retain the ordering of an associative array? When the elements are added then looped over using a foreach, the order is different.