SListRange, Ranges, costructors
bearophileHUGS at lycos.com
Mon Apr 12 23:45:57 PDT 2010
Daniel Keep Wrote:
> You don't need reset if you make the range a property of the list. Then
> you would use `foreach( x ; list.elements )` or something.
In the List(T) code that I've shown there is a ListIterable struct and a opSlice() that returns it. If you uncomment that part of the code you can use foreach(x; alist). (I have copied this usage of opSlice() from Andrei).
But the purpose of my original post was to note that with a reset() method, that foreach can call automatically (if reset() is present), we can avoid that opSlice syntax, or a method like "all" or "elements". So my purpose was to suggest a possible small idea to avoid some clutter in the code that uses the data structure :-) (Maybe Andrei will comment about this when he's back from the ACCU).
More information about the Digitalmars-d