On Sunday, 13 March 2016 at 10:06:24 UTC, stunaep wrote:
On Sunday, 13 March 2016 at 08:33:43 UTC, Jonathan M Davis
wrote:
On Sunday, March 13, 2016 02:35:27 stunaep via
Digitalmars-d-learn wrote:
[...]
The closest that we have in Phobos at the moment is
RedBlackTree in std.container. Its API is geared towards sets,
not maps, but you can get it to work as a map if you define
the comparison functions appropriately. Red-black trees are
typically used for both sets and maps, so using RedBlackTree
in that manner is pretty normal from an implementation
perspective, but there's no question that what we really need
is a wrapper around it that provides a map API, since it's not
terribly user-friendly to use the set API for a map, much as
it works.
[...]
Wow, thanks!
Note that implementing an (admitedly not perfect) ordered
associative array yourself really isn't much work:
https://github.com/cym13/miscD/blob/master/ordered_aa.d