https://issues.dlang.org/show_bug.cgi?id=17771
--- Comment #8 from Steven Schveighoffer <[email protected]> --- (In reply to Alex Goltman from comment #7) > Actually map does works on const NumRange, since it's declared as: > > auto map(Range)(Range r) if (isInputRange!(Unqual!Range)) Yep, I didn't realize that, ironic that I picked map as the example :) However, there are other functions that aren't checked this way, and most user code isn't going to do this. It's the wrong way to approach this IMO. > Why shouldn't foreach work as well? I'll leave the issue open, as there obviously are some in the core team who find such subtleties worth considering, given the state of std.algorithm. I still don't these kinds of tricks are worth the confusion they can cause, especially when a suitable converter is easily had and used. --
