D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8764 - chunks.transposed causes infinite ranges.
Summary: chunks.transposed causes infinite ranges.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2012-10-05 06:55 UTC by Simen Kjaeraas
Modified: 2014-07-17 15:23 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Simen Kjaeraas 2012-10-05 06:55:12 UTC
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 hsteoh 2013-02-12 17:12:04 UTC
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 github-bugzilla 2014-07-17 15:23:34 UTC
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.