On Thursday, 26 January 2017 at 12:03:39 UTC, guest wrote:
On Thursday, 26 January 2017 at 11:32:09 UTC, ZombineDev wrote:
Not sure if this is a bug in isInputRange or foreach, but they
should work consistently.
Copy/paste from primitives.d:
template isInputRange(R)
{
enum bool isInputRange = is(typeof(
(inout int = 0)
{
R r = R.init; // can define a range object
if (r.empty) {} // can test for empty
r.popFront; // can invoke popFront()
auto h = r.front; // can get the front of the range
}));
}
Yes, I know how isInputRange is implemented. The question is:
should it disallow pointers if foreach does not try to
dereference them automatically, or should foreach do that.