Ordering an associative array - or - another option

simendsjo simendsjo at gmail.com
Wed Jun 6 07:10:16 PDT 2012


On Wednesday, 6 June 2012 at 14:04:17 UTC, Paul wrote:
> I have and array string[string][string][string] that works 
> great for everything I need except that they (assoc. arrays) 
> don't maintain an order.  I need to maintain the order of entry.
>
> Are there any work arounds that others have used?  I saw some 
> tricks in the book for sorting a single dimensional assoc. 
> array.
>
> Thanks to all!

As you say, AAs are unordered. Instead of a string, you could use 
a struct that contains a position as well as the string and sort 
before you need to traverse the values in order.


More information about the Digitalmars-d-learn mailing list