digitalmars.D.bugs - [Issue 17952] New: std.range.transposed save is invalid
- d-bugmail puremagic.com (26/26) Oct 30 2017 https://issues.dlang.org/show_bug.cgi?id=17952
https://issues.dlang.org/show_bug.cgi?id=17952 Issue ID: 17952 Summary: std.range.transposed save is invalid Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: schveiguy yahoo.com auto x = [[1,2,3],[4,5,6]].transposed; auto y = x.save; assert(x.equal([[1,4],[2,5],[3,6]])); y.popFront; assert(x.equal([[1,4],[2,5],[3,6]])); // FAILS, x is really [[2,5],[3,6]] The only way .save can truly be implemented is by duplicating the RangeOfRanges range, and there is no standard for doing this (.dup is not consistent across ranges). We have 2 options: 1. Deprecate .save (i.e. make transposed NOT a forward range) 2. convert the RangeOfRanges element to an array, and duplicate on every .save. Neither option is particularly good. My vote would be for option 1. --
Oct 30 2017