unordered output of an associated array of associated arrays
forkit
forkit at gmail.com
Tue Jan 25 00:43:07 UTC 2022
On Tuesday, 25 January 2022 at 00:39:05 UTC, H. S. Teoh wrote:
>
>
> AA's are unordered containers. Do not rely on entries to appear
> in any specific order when you traverse an AA; it is
> implementation-dependent and may differ from OS to OS /
> platform to platform / sequence of operations performed on the
> AA since its initialization / phase of the moon. Any specific
> order that may appear in an AA is pure coincidence and may not
> appear again next time, or may only appear again at 11:59:59
> Feb 29 under a blue moon.
>
> If you need entries in your AA in a specific order, extract
> them (or their keys) into an array then sort them yourself.
> E.g.:
>
> string[string] myAA;
> auto keys = myAA.keys;
> sort(keys);
> foreach (k; keys) {
> ... // now keys will be in the expected order
> }
>
>
> T
oh. thanks :-)
I will get that integrated into my example code, and will post
again, once it's working (so others can learn too)
More information about the Digitalmars-d-learn
mailing list