Bug 7884 – std.file.DirIterator.opApply is wrong.

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-10T03:54:00Z
Last change time
2012-04-10T03:59:22Z
Assigned to
nobody
Creator
timon.gehr

Comments

Comment #0 by timon.gehr — 2012-04-10T03:54:23Z
std.file.DirIterator.opApply always returns '1' instead of the result of the delegate call. This makes it impossible to properly exit from a foreach body that uses the DirIterator as the aggregate via a return or goto statement.
Comment #1 by timon.gehr — 2012-04-10T03:59:22Z
Apparently this is fixed in git head: struct DirIterator { private: RefCounted!(DirIteratorImpl, RefCountedAutoInitialize.no) impl; this(string pathname, SpanMode mode, bool followSymlink) { impl = typeof(impl)(pathname, mode, followSymlink); } public: @property bool empty(){ return impl.empty; } @property DirEntry front(){ return impl.front; } void popFront(){ impl.popFront(); } } No opApply anymore.