[Issue 15027] cannot pass arguments of type DirEntry to std.file functions

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Oct 2 18:56:55 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=15027

--- Comment #4 from Walter Bright <bugzilla at digitalmars.com> ---
The trouble is InputRange has to modify the range.

A solution is to rewrite DirEntry.name from:
        @property string name() const pure nothrow
        {
            return _name;
        }
to:
        string _name2;
        @property ref string name() return const pure nothrow
        {
            _name2 = _name;
            return _name2;
        }
but there'll be trouble with that if there are two calls to name() within the
same expression and both try to modify through the ref.

--


More information about the Digitalmars-d-bugs mailing list