How to define an interator to provide array like behaviour in a class?

Jonathan M Davis jmdavisProg at gmx.com
Tue Oct 16 23:17:16 PDT 2012


On Wednesday, October 17, 2012 08:14:45 Jacob Carlborg wrote:
> On 2012-10-17 00:23, Jonathan M Davis wrote:
> > 2. Or make it a range (see
> > http://dlang.org/statement.html#foreach_with_ranges and
> > http://ddili.org/ders/d.en/ranges.html ), which would probably be a bad
> > idea, since containers really shouldn't be ranges.
> 
> Why is that a bad idea?

For starters, iterating over the container would empty it.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list