Bug 14479 – isInputRange returns false on a slice of noncopyables.

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2015-04-21T20:35:00Z
Last change time
2015-06-09T05:14:38Z
Assigned to
nobody
Creator
block8437

Comments

Comment #0 by block8437 — 2015-04-21T20:35:39Z
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 .
Comment #1 by block8437 — 2015-04-21T20:39:16Z
*** This issue has been marked as a duplicate of issue 14478 ***