Bug 16429 – Sorted multimap data structure based on std.container.rbtree

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2016-08-25T15:33:49Z
Last change time
2024-12-01T16:27:44Z
Assigned to
No Owner
Creator
Neia Neutuladh
Moved to GitHub: phobos#10196 →

Comments

Comment #0 by dhasenan — 2016-08-25T15:33:49Z
It's not unusual to need a sorted map or multimap. For instance, a sparse event queue is easily implemented as a sorted multimap. While it's not exactly difficult to implement that using std.container.rbtree, you need to know the trick of creating a struct that only uses one member in its comparator, implement that struct, then make a wrapper around the redblack tree implementation. And that's assuming you know that a redblack tree can support the required operations before looking at the module names in std.container, and you're not tired or stressed enough to miss that the implementation presents an interface appropriate for the purpose of finding the lowest element etc. It would be nicer to present a module 'std.container.sortedmap' that does the work for you, presents the interface you expect, and has a name that tells you it does what you're after. The module could present map and multimap variants.
Comment #1 by robert.schadek — 2024-12-01T16:27:44Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10196 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB