[Issue 17742] std.range.transposed does not have opIndex

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 30 15:37:39 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=17742

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com

--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> ---
Vladimir, would appreciate your input on the PR:
https://github.com/dlang/phobos/pull/5805

Currently, transposed uses `filter` to remove elements from the range
transposition when the underlying column has become empty.

So for instance:

assert([[1,2,3], [4,5], [6,7,8]].transposed.equal([[1,4,6], [2,5,7], [3,8]]);

Note the jaggedness of the range of ranges changes in weird ways, especially
when holes appear in the middle.

While this may be reasonable, it precludes performing opIndex on an element of
the transposed result. So while transposed can be indexed if the ranges
individually can be indexed, the resulting elements cannot be, making your code
example unimplementable.

--


More information about the Digitalmars-d-bugs mailing list