On Friday, 26 May 2017 at 09:59:26 UTC, zakk wrote:
1) Why is D making using of the binary ! operator, which as far as I understand introduces a template?
The exclamation mark here is not a binary operator, it's used in D templates to define where compile-time parameters are.
2) Why is a template needed here?
It's a template so you can use differently typed ranges. Remember a range is an interface and very different types can implement it.
3) It seems to me like the argument passed to the template is a lambda expression. I only know about templates taking types as argument. What's going on?
The function parameter is defined as an alias which is also valid at compile-time.
https://dlang.org/phobos/std_algorithm_sorting.html#sort