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

--- Comment #0 from 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

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

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to