Has AA .keys the same order as .values?

Alex Rønne Petersen alex at lycus.org
Mon Jul 30 09:12:26 PDT 2012


On 30-07-2012 18:00, Rene Zwanenburg wrote:
> Hi,
>
> I need to interleave multiple arrays stored in an AA into a single
> array, and the keys of the AA need to be stored separately in the same
> order as the interleaved data. As an example:
>
> auto aa = [
>    "1" : [1, 2],
>    "2" : [3, 4],
>    "3" : [5, 6],
>    "4" : [7, 8]
> ]
>
> auto values = aa.values;
> auto keys =  aa.keys;
>
> //Store keys, and interleave values
>
> I did a quick test and values has the same order as keys, but is this
> guaranteed to be the case?

Ordering is not guaranteed at all in AAs.

-- 
Alex Rønne Petersen
alex at lycus.org
http://lycus.org


More information about the Digitalmars-d-learn mailing list