arrayChunks

This range iterates over fixed-sized chunks of size chunkSize of a source range. Source must be an input range. chunkSize must be greater than zero.

See Also: std.range.chunks

arrayChunks
(
Source
)
(
Source range
,
in size_t chunkSize
)
if (
isInputRange!Source
)

Return Value

Type: auto

Range of chunks, ie. ElementType!Source[].

Examples

1 import std.array : array;
2 import std.range : iota;
3 
4 auto chunks = iota(10).arrayChunks(2);
5 assert(chunks.array == [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]]);

Meta