http://d.puremagic.com/issues/show_bug.cgi?id=5691
Summary: walkLength() compatible with opApply() Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2011-03-03 12:42:36 PST --- std.range.walkLength() has to return the length of any collection or lazy iterable that has a length property or is iterable, like a struct with opApply(): import std.range: walkLength; struct Iter { int stop; int opApply(int delegate(ref int) dg) { int result; foreach (i; 0 .. stop) { result = dg(i); if (result) break; } return result; } } void main() { assert(walkLength(Iter(10)) == 10); } But DMD 2.052 gives: test.d(14): Error: template std.range.walkLength(Range) if (isInputRange!(Range)) does not match any function template declaration test.d(14): Error: template std.range.walkLength(Range) if (isInputRange!(Range)) cannot deduce template function from argument types !()(Iter) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------