digitalmars.D.learn - Ranges
- %u (10/10) Feb 07 2011 I've learned that an InputRange needs three methods to enumerate a colle...
- Lars T. Kyllingstad (4/19) Feb 07 2011 Related discussion:
- %u (1/3) Feb 08 2011 Oh sorry; thank you for the link!
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.
Feb 07 2011
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
Feb 07 2011
Related discussion: http://www.digitalmars.com/d/archives/digitalmars/D/getNext_113217.htmlOh sorry; thank you for the link!
Feb 08 2011