May 08, 2011 [Issue 4264] Support opApply in std.algorithm, std.range where possible | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4264 --- Comment #10 from kennytm@gmail.com 2011-05-08 00:00:18 PDT --- *** Issue 5952 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 28, 2012 [Issue 4264] Support opApply in std.algorithm, std.range where possible | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4264 --- Comment #11 from bearophile_hugs@eml.cc 2012-08-28 15:33:46 PDT --- This code: import std.stdio: writeln; struct Iter2 { int stop, current; @property int front() { return current; } @property bool empty() { return current == stop; } void popFront() { current++; } } void main() { writeln(Iter2(10)); } Shows that writeln supports the range protocol: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] While this code: import std.stdio: writeln; struct Iter { int stop; int opApply(int delegate(ref int) dg) { int result; for (int i = 0; i < stop; i++) { result = dg(i); if (result) break; } return result; } } void main() { writeln(Iter(10)); } Outputs this, showing writeln doesn't support opApply iterables: Iter(10) I'd like writeln() to show the items here too. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation