How to define an interator to provide array like behaviour in a class?
Jacob Carlborg
doob at me.com
Wed Oct 17 09:58:52 PDT 2012
On 2012-10-17 17:45, Jonathan M Davis wrote:
> Well, what would you expect? Ranges are consumed when you iterate over them.
> So, if an container is a range, it will be consumed when you iterate over it.
> That's the way that it _has_ to work given how ranges work, and that's why you
> overload opSlice to return a range which is iterated over rather than making
> the container itself a range.
How does this work with built-in arrays?
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list