Deprecation: module std.stream is deprecated

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 7 05:30:33 PST 2015


On Saturday, November 07, 2015 12:10:05 Spacen Jasset via Digitalmars-d-learn wrote:
> Deprecation: module std.stream is deprecated - It will be removed
> from Phobos in October 2016.
>
> The std.stream module documentation doesn't give any clues as to
> what an alternative might be.
>
> I have this sort of code:
>
> this(InputStream input)
>   {
>
>       int line_no = 1;
>       foreach (char[] line; input) {
>
> Am I right in thinking to use std.stdio with an InputRange?

At this point, you pretty much have three options:

1. Use std.stdio.File and read it in in pieces (e.g. with byLine or
byChunk).

2. Read the whole file in at once with std.file.read or std.file.readText.

3. Use std.mmfile.MmFile to mmap the file so that the parts that you access
get read into memory, and the rest don't get loaded from disk, but you get
to operate on the whole file as if you had read it all from disk.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list