June 09, 2015 [Issue 3872] std.algorithm.filter could become bidirectional if its input range is bidir | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=3872 Andrei Alexandrescu <andrei@erdani.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|2.040 |D2 -- |
March 09, 2023 [Issue 3872] std.algorithm.filter could become bidirectional if its input range is bidir | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=3872 FeepingCreature <default_357-line@yahoo.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |default_357-line@yahoo.de Resolution|FIXED |--- --- Comment #2 from FeepingCreature <default_357-line@yahoo.de> --- Got unfixed at some point: ``` import std.algorithm : filter; import std.range : only; void main() { int[] a = [2, 3]; assert(only(2, 3).back == 3); assert(a.filter!"a == 2".back == 2); } ``` => onlineapp.d(7): Error: no property `back` for `filter(a)` of type `std.algorithm.iteration.FilterResult!(unaryFun, int[])` Apparently there's `filterBidirectional`. I am violently opposed to that function and all it represents. `filter` should support bidirectional iteration by default, with maybe `filterUnidirectional` or `forceForwardRange` if you want to *disable* it. Since when do we sacrifice functionality for speed by default? -- |
Copyright © 1999-2021 by the D Language Foundation