Bug 19077 – DirIterator cannot be used as range

Status
RESOLVED
Resolution
INVALID
Severity
blocker
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-07-11T17:56:31Z
Last change time
2018-07-11T18:03:29Z
Assigned to
No Owner
Creator
Szabo Bogdan

Comments

Comment #0 by contact — 2018-07-11T17:56:31Z
`std.file.dirEntries` should return an input range, but this code does not compile: auto range = dirEntries("files/", SpanMode.depth) .map(a => a); Error: template std.algorithm.iteration.map cannot deduce function from argument types !()(DirIterator, void), candidates are: /usr/include/dmd/phobos/std/algorithm/iteration.d(457,1): std.algorithm.iteration.map(fun...) if (fun.length >= 1)
Comment #1 by contact — 2018-07-11T18:03:29Z
this is not a bug... it should be like this: auto range = dirEntries("files/", SpanMode.depth) .map!(a => a)