[Issue 17771] foreach over const input range fails

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Aug 22 08:03:45 PDT 2017


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

Alex Goltman <alex.goltman at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #7 from Alex Goltman <alex.goltman at gmail.com> ---
Actually map does works on const NumRange, since it's declared as:

    auto map(Range)(Range r) if (isInputRange!(Unqual!Range))

Why shouldn't foreach work as well? 

It's not a critical bug, but fixing this would remove an annoyance which would
make D users much less frustrated. Please don't dismiss this before really
evaluating what would it take to fix it, because currently we don't see a
reason for this not to just work, as map does already.

--


More information about the Digitalmars-d-bugs mailing list