Eager dirEntries

Jonathan M Davis jmdavisProg at gmx.com
Mon Mar 21 16:50:56 PDT 2011


> Andrej Mitrovic:
> > this won't compile:
> > 
> > string[] entries = array(dirEntries(directory, SpanMode.shallow));
> 
> Do you know why?

Yes. With dirEntries, you have to tell it the iteration type. It could be 
either a DirEntry or a string. As such, it fails the template constraint for 
array. It would probably be possible to extend array to work with it (with you 
giving it the iteration type as a template argument), but array would have to 
be reworked a bit for that to work.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list