Bug 15682 – Implement efficient setops for builtin AAs

Status
RESOLVED
Resolution
INVALID
Severity
enhancement
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-02-15T03:42:00Z
Last change time
2016-04-29T03:33:15Z
Assigned to
nobody
Creator
b2.temp

Comments

Comment #0 by b2.temp — 2016-02-15T03:42:56Z
With performance in mind. To allow this: --- string[string]aa0,aa1; void main() { aa0~=aa1; } --- instead of writing a loop.
Comment #1 by petar.p.kirov — 2016-04-11T09:59:29Z
Currently, Phobos provides setops only for sorted ranges (http://dlang.org/phobos/std_algorithm_setops). It would be great if druntime could expose primitives that would allow efficient set operations over builtin AAs, including concatenation (set union), as per OP. As buitin AAs are implemented as hash tables (i.e. they are unordered) it is not possible to implement efficiently set operations only using the byKey, byValue and byKeyValue, etc. ranges.