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

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Nov 9 14:32:29 PST 2014


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

--- Comment #3 from bearophile_hugs at eml.cc ---
(In reply to Peter Alexander from comment #1)
> How do you make opIndex O(1) for a joiner range? Surely you have to count up
> the lengths of all the sub ranges until you hit the desired index? That's
> O(n).

In the common use case I've shown, where you have an array of array, all array
lengths are known. If joiner caches internally the lengths of all the rows, the
successive accesses are O(1). This requires some heap memory...

--


More information about the Digitalmars-d-bugs mailing list