range slicing
kuba
kuba456 at gmail.com
Tue Feb 11 13:48:28 PST 2014
Hi everyone,
This is my first post here :)
In order to get a slice of a range (to access some initial
elements) I have to convert a range into array first. I wonder
what is preferred approach? Should I use slicing or stick with
for loops? Also turning the range into array forces the range to
be computed entirely, killing the lazy nature of the dirEntries
function. Could it be a bottleneck down the road?
auto dir = "/data/home/kuba";
auto dirs = dirEntries(dir,SpanMode.shallow);
auto arr = array(dirs);
writeln(arr[2..4]);
Thank you,
kuba
More information about the Digitalmars-d
mailing list