Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
March 31, 2018 [Issue 13903] std.array.removeIf for associative arrays | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13903 Seb <greensunny12@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |greensunny12@gmail.com --- Comment #1 from Seb <greensunny12@gmail.com> --- Not sure whether such one/two-liners would be accepted to Phobos. --- import std.experimental.all; auto removeIf(alias pred, AA)(AA aa) { aa.byPair.filter!(not!pred).each!(e => aa.remove(e.key)); return aa; } void main() { auto aa = ["a" : 1, "b" : 2]; aa.removeIf!(a => a.key == "a").writeln; } --- But efficiency and bug-proneness are two good points. -- |
June 18, 2019 [Issue 13903] std.array.removeIf for associative arrays | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13903 Steven Schveighoffer <schveiguy@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |schveiguy@yahoo.com --- Comment #2 from Steven Schveighoffer <schveiguy@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. -- |
June 18, 2019 [Issue 13903] std.array.removeIf for associative arrays | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13903 --- Comment #3 from Steven Schveighoffer <schveiguy@yahoo.com> --- I think especially if you remove the CURRENT element while iterating you are in for trouble. -- |
December 17, 2022 [Issue 13903] std.array.removeIf for associative arrays | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13903 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P4 -- |
December 01 [Issue 13903] std.array.removeIf for associative arrays | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13903 --- Comment #4 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10108 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation