Re: Iterators in structs

2020-06-25 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 25 June 2020 at 18:47:42 UTC, repr-man wrote: struct ChunksOf(R) { Chunks!R iter; this(R r, size_t width) { this.iter = r.chunks(width); assert(is(typeof(iter) == Chunks!R)); } } This works, only if I change the declaration of x in main() to: au

Iterators in structs

2020-06-25 Thread repr-man via Digitalmars-d-learn
As an extension of my previous thread (https://forum.dlang.org/thread/nupwljahyutnyxdvp...@forum.dlang.org), I wanted to ask about iterators in structs. I will start with the following code: void main() { int[5] a = [0, 1, 2, 3, 4]; int[5] b = [5, 6, 7, 8, 9]; auto x = ChunksOf