prune with dirEntries

Jonathan M Davis jmdavisProg at gmx.com
Fri Nov 30 11:52:09 PST 2012


On Friday, November 30, 2012 13:02:50 Dan wrote:
> On Friday, 30 November 2012 at 07:29:59 UTC, Joshua Niehus wrote:
> > On Friday, 30 November 2012 at 06:29:01 UTC, Joshua Niehus
> > 
> > wrote:
> >> I think if you go breadth first, you can filter out the
> >> unwanted directories before it delves into them
> 
> Good idea, thanks. I could not get original to compile as is -
> but the concept is just what was needed. I got an error on line 8:
> Error: not a property dirEntries(path, cast(SpanMode)0,
> true).filter!(__lambda2)
> I'm using a quite recent version of dmd and phobos.

If you're compiling with -property, filter must have the parens for the 
function call as it's a function, not a property. The !() is for the template 
arguments and is separate from the parens for the function call. That means 
that if you're compiling with -property and using UFCS, then you end up with 
range.filter!(pred)(), whereas you have range.filter!(pred).

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list