[Issue 8405] Create overload for joiner which is random access for random access ranges

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 3 15:00:33 UTC 2018


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

Seb <greensunny12 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |greensunny12 at gmail.com
         Resolution|---                         |WONTFIX

--- Comment #6 from Seb <greensunny12 at gmail.com> ---
> If joiner caches internally the lengths of all the rows, the successive accesses are O(1). This requires some heap memory...

Even assuming we could convince Andrei that creating joinerRandomAccess for
this is justified.
This would still never work because joiner removes empty elements:

---
auto j = [null, new int(1), null, new int(2), null];
j.writeln// [7F49B04CD010, 7F49B04CF018]
j[1] = 5; // which one?
----

Which would - if supported - would require serious work and allocation from
joiner.
The other option would be sth. like joinerRandomAccessAssumeNonEmpty

Also as a user can always do `r.take(n).front` - that's as efficient as joiner
could ever get.

I'm going to close this no as WONTFIX, because doing > O(n) work for an opIndex
in unacceptable and joinerRandomAccessAssumeNonEmpty ain't happening in the
standard library.

--


More information about the Digitalmars-d-bugs mailing list