On Monday, 11 March 2019 at 17:33:31 UTC, HaraldZealot wrote:
Ah yes, I forget about laziness of `map`. BTW, I have found other solution, which is more fit to my initial intention.

```d
ReturnType!(std.stdio.File.byLineCopy!(char, immutable(char)))[] ranges;
foreach(filename; args[1 .. $])
{
    ranges ~= File(filename, "r").byLineCopy;
}
```

An easier way to do this is to use the library function `std.array.array`:

auto ranges = args[1..$].map!(a => File(a, "r").byLineCopy).array;

Reply via email to