[Issue 13565] New: add AA batch remove using a predicate function
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Oct 1 15:04:49 PDT 2014
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: nobody at puremagic.com
Reporter: code at dawg.eu
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));
--
More information about the Digitalmars-d-bugs
mailing list