Can the order in associative array change when keys are not midified?
Tobias Pankrath via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jan 1 10:29:36 PST 2015
On Thursday, 1 January 2015 at 18:08:52 UTC, Andrej Mitrovic via
Digitalmars-d-learn wrote:
> On 1/1/15, H. S. Teoh via Digitalmars-d-learn
> <digitalmars-d-learn at puremagic.com> wrote:
>> If you need consistent ordering of values, you probably want a
>> different
>> data structure, like an ordered map
>
> This one works nicely on D1, I'd imagine the D2 port works just
> the same:
>
> https://github.com/SiegeLord/Tango-D2/blob/d2port/tango/util/container/SortedMap.d
You could implement an OrderedMap!(Key, Value) via
RedBlackTree!(Tuple!(Key, Value), (a,b) => a[0] < b[0]).
More information about the Digitalmars-d-learn
mailing list