Bug 9616 – SortedRange should support all range kinds

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-02-28T15:26:00Z
Last change time
2014-05-01T18:03:25Z
Assigned to
nobody
Creator
andrei
Blocks
9682

Comments

Comment #0 by andrei — 2013-02-28T15:26:41Z
There's no inherent reason for which SortedRange shouldn't support all kinds of ranges. There are e.g. files that are known to be sorted, and there are algorithms on sorted ranges that don't need random access, such as merge, diff etc.
Comment #1 by bearophile_hugs — 2013-02-28T15:50:26Z
I have converted this to an enhancement request, if that's OK. Is this ER vaguely related to this question I have asked? http://forum.dlang.org/thread/[email protected] If SortedRange supports Input Ranges too, then group(SortedRange) is able to be a SortedRange. But unfortunately if you apply an array on that lazy SortedRange, you get an array and you lose the SortedRange quality. In my code I'd like to perform a binary search on the result of a "sort.group.array". Currently I have to use "sort.group.array.assumeSorted".
Comment #2 by github-bugzilla — 2014-05-01T18:03:24Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/8366c67d9e2dbdd0ddfcc6e56b135b09dd9ccfce Fix Issue 9616 - SortedRange should support all range kinds https://github.com/D-Programming-Language/phobos/commit/6095350e2a9f7538445a658f42b83cd378356c64 Fix Issue 9616 - SortedRange should support all range kinds https://github.com/D-Programming-Language/phobos/commit/3f4fde200294d194a82d0a28e6401978d6138395 Merge pull request #2139 from monarchdodra/sortedrange Fix Issue 9616 - SortedRange should support all range kinds