chunks

Generate a tuple of tuples of chunkSize.

template chunks(size_t chunkSize)
chunks
pure nothrow @safe
(
T...
)
()
if (
args.length >= chunkSize
)

Examples

1 auto c1 = chunks!2(0, 1, 2, 3, 4, 5);
2 
3 assert(c1 == tuple(tuple(0, 1), tuple(2, 3), tuple(4, 5)));
4 
5 auto c2 = chunks!3(false, "1", 2.0, 3, '4', 5);
6 
7 assert(c2 == tuple(tuple(false, "1", 2.0), tuple(3, '4', 5)));
8 
9 enum c4 = chunks!4(false, "1", 2.0, 3, '4', 5);
10 
11 static assert(c4 == tuple(tuple(false, "1", 2.0, 3), tuple('4', 5)));

Meta