From 2621b7fe7e60820dcbc4d2b51c9364411f07589e Mon Sep 17 00:00:00 2001 From: rsw0x Date: Sat, 21 Mar 2015 18:43:17 -0400 Subject: [PATCH] Issue 13590 Add stdio.byChunk example using algorithm.joiner --- std/stdio.d | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/std/stdio.d b/std/stdio.d index 7ff6713d1..1f2e48c48 100644 --- a/std/stdio.d +++ b/std/stdio.d @@ -2196,6 +2196,20 @@ void main() } --- +$(XREF algorithm, joiner) can be used to join chunks together into a single +range lazily. +Example: +--- +import std.algorithm, std.stdio; +void main() +{ + //Range of ranges + static assert(is(typeof(stdin.byChunk(4096).front) == ubyte[])); + //Range of elements + static assert(is(typeof(stdin.byChunk(4096).joiner.front) == ubyte)); +} +--- + Returns: A call to $(D byChunk) returns a range initialized with the $(D File) object and the appropriate buffer.