Bug 8473 – Guaranteed relative key-values with byKey and byValue

Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-07-30T09:35:00Z
Last change time
2015-05-19T00:14:40Z
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-07-30T09:35:30Z
This is a spinoff of Issue 5466 There is a common need to have a (lazy) range of keys and their corresponding values of an associative array. Sometimes iterating them in parallel with a foreach is not enough, and performing a lookup for each key generated by byKeys is not efficient. So I suggest to state in the D docs that if the associative array is not modified in the iteration, its byKey and byValue yield corresponding key-values (this is currently true, but not guaranteed to be true in all D implementations). This means that this will always be true in all future D implementations: zip(aa.byKey, aa.byValue) === aa.byPair
Comment #1 by dlang-bugzilla — 2015-05-19T00:14:40Z