On 10/06/2016 09:54 PM, TheGag96 wrote:
Interestingly enough, I found that using .each() actually compiles
without the []
[...]
why can the compiler consider it a range here but not
.sort()?

each is not restricted to ranges. It accepts other `foreach`-ables, too. The documentation says that it "also supports opApply-based iterators", but it's really anything that foreach accepts.

Relevant piece of the source:
https://github.com/dlang/phobos/blob/08c587ead2156c85c30a2bbc18028b5967010682/std/algorithm/iteration.d#L913-L914

Reply via email to