www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7884] New: std.file.DirIterator.opApply is wrong.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7884

           Summary: std.file.DirIterator.opApply is wrong.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: timon.gehr gmx.ch



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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 10 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7884


timon.gehr gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME



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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 10 2012