[Issue 14479] New: isInputRange returns false on a slice of noncopyables.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Apr 21 13:35:39 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14479

          Issue ID: 14479
           Summary: isInputRange returns false on a slice of noncopyables.
           Product: D
           Version: unspecified
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: block8437 at gmail.com

Example: http://dpaste.dzfl.pl/644619159a4f

import std.range, std.stdio;

struct Noncopyable {
    int num;
    @disable this(this);
}


void main() {
    writeln(isInputRange!(Noncopyable[]));
}

It is believed that this problem is caused by r.front needing to return a value
instead of a reference, in contradiction of the docs, which say "r.front
returns the current element in the range.  It may return by value or by
reference."

This prevents using range utility functions like chain() on arrays of
noncopyables, such as in http://dpaste.dzfl.pl/3993a52c54df .

--


More information about the Digitalmars-d-bugs mailing list