Bug 8764 – chunks.transposed causes infinite ranges.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-10-05T06:55:00Z
Last change time
2014-07-17T15:23:34Z
Keywords
pull
Assigned to
nobody
Creator
simen.kjaras

Comments

Comment #0 by simen.kjaras — 2012-10-05T06:55:12Z
import std.range; import std.stdio : writeln; void main( ) { ulong[1] t0; auto t1 = t0[].chunks(1).transposed; writeln(t1); } The above code spews out a never-ending string of [0]s. Add a very simple .array before .transposed, and things work perfectly.
Comment #1 by hsteoh — 2013-02-12T17:12:04Z
https://github.com/D-Programming-Language/phobos/pull/1138 Note that calling .array will be made mandatory, because Chunks does not have assignable subranges, so there's no way transpose can possibly work for it (popping of subranges does not have lasting effect on the parent container).
Comment #2 by github-bugzilla — 2014-07-17T15:23:34Z
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/4113afc85a30b0413ee710cfd9300ca945908836 Fix issue 8764 Transposed can only work with ranges of ranges if the subranges are assignable. Add signature constraints. Fix forward range bugs (should use .save instead of just copying the range object). Add unittests.