[Issue 13903] std.array.removeIf for associative arrays
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 18 23:55:59 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=13903
Steven Schveighoffer <schveiguy at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |schveiguy at yahoo.com
--- Comment #2 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to Seb from comment #1)
> auto removeIf(alias pred, AA)(AA aa)
> {
> aa.byPair.filter!(not!pred).each!(e => aa.remove(e.key));
> return aa;
> }
This implementation isn't valid. You can't remove while iterating. You would
need to somehow lock the AA from rehashing as you removed items.
--
More information about the Digitalmars-d-bugs
mailing list