digitalmars.D.bugs - [Issue 13824] New: std.range.transposed irrevocably modifies subranges
- via Digitalmars-d-bugs (32/32) Dec 05 2014 https://issues.dlang.org/show_bug.cgi?id=13824
https://issues.dlang.org/show_bug.cgi?id=13824 Issue ID: 13824 Summary: std.range.transposed irrevocably modifies subranges Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: Phobos Assignee: nobody puremagic.com Reporter: hsteoh quickfur.ath.cx Code: ------ void main() { import std.stdio; import std.range; auto data = [ [1,2,3], [4,5,6], [7,8,9] ]; writeln(data.transposed()); writeln(data); } ------ Output: ------ [[1, 4, 7], [2, 5, 8], [3, 6, 9]] [[], [], []] ------ This limits the usefulness of transposed(), since a copy of the original range of ranges must be made if it needs to be used again in its original form after iterating over its transposed() wrapper. --
Dec 05 2014