Thread overview | |||||
---|---|---|---|---|---|
|
February 08, 2011 Ranges | ||||
---|---|---|---|---|
| ||||
I've learned that an InputRange needs three methods to enumerate a collection: void popFront() @property T front() @property bool empty() but is that really necessary? Why not just have: bool next(out T value); ? Wouldn't this be much cleaner? Even the .NET implementation of IEnumerator only has two methods used for enumeration (MoveNext() and Current), instead of three. |
February 08, 2011 Re: Ranges | ||||
---|---|---|---|---|
| ||||
Posted in reply to %u | On Tue, 08 Feb 2011 05:03:34 +0000, %u wrote: > I've learned that an InputRange needs three methods to enumerate a collection: > > void popFront() > @property T front() > @property bool empty() > > but is that really necessary? Why not just have: > > bool next(out T value); > > ? > Wouldn't this be much cleaner? Even the .NET implementation of > IEnumerator only has two methods used for enumeration (MoveNext() and > Current), instead of three. Related discussion: http://www.digitalmars.com/d/archives/digitalmars/D/getNext_113217.html -Lars |
February 08, 2011 Re: Ranges | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars T. Kyllingstad | > Related discussion: http://www.digitalmars.com/d/archives/digitalmars/D/getNext_113217.html
Oh sorry; thank you for the link!
|
Copyright © 1999-2021 by the D Language Foundation