https://issues.dlang.org/show_bug.cgi?id=13565
Issue ID: 13565
Summary: add AA batch remove using a predicate function
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P2
Component: druntime
Assignee: [email protected]
Reporter: [email protected]
To remove multiple AA entries at once we should support calling aa.remove with
a predicate function, taking key and value.
Old code:
Louter: while (true)
{
Key key;
foreach (k, v; aa) {
if (!pred(k, v)) continue;
aa.remove(k);
continue Louter;
}
break;
}
New code:
aa.remove((k, v) => pred(k, v));
--