[Issue 17771] foreach over const input range fails

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Aug 22 06:39:13 PDT 2017


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

--- Comment #5 from Steven Schveighoffer <schveiguy at yahoo.com> ---
But the problem is that almost all range code is templated, so you are going to
test with something that works, and then it will fail with something that
doesn't. Subtle inconsistencies like this have a cost.

I'll also note that a const range, in this case, is not actually a range:

const NumRange n;

static assert(!isInputRange!(typeof(n)));

This would result in a stream of bugs like "it works with foreach but not with
map, why not?"

--


More information about the Digitalmars-d-bugs mailing list