[Issue 4264] Support opApply in std.algorithm, std.range where possible
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Aug 28 15:33:57 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4264
--- Comment #11 from bearophile_hugs at 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: -------
More information about the Digitalmars-d-bugs
mailing list