Bug 18797 – Use of "isInputRange" in various functions is overly-restrictive

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-04-25T12:11:27Z
Last change time
2024-12-01T16:33:35Z
Assigned to
No Owner
Creator
Eyal
Moved to GitHub: phobos#9756 →

Comments

Comment #0 by eyal — 2018-04-25T12:11:27Z
std.algorithm.sorting.topNCopy, for example, uses isInputRange!SRange when it merely iterates its elements. To iterate the elements, an opApply range is fine, but is unnecessarily forbidden. Various other phobos functions use isInputRange when they only need the ability to iterate. Need a "isForeachRange" template perhaps, to replace "isInputRange" when only foreach is needed? Or perhaps an assertion on the "ForeachType!T" should be used instead here?
Comment #1 by simen.kjaras — 2018-04-25T12:29:09Z
> Need a "isForeachRange" template perhaps https://dlang.org/phobos/std_traits#isIterable
Comment #2 by robert.schadek — 2024-12-01T16:33:35Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9756 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB