std.algorithm sort() and reverse() confusion

FG via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 30 09:42:57 PST 2015


On 2015-01-30 at 17:07, Paul wrote:
> writeln("Sorted, reversed: ", reverse(myVals));
>
> Gives me...
>
> Error: template std.stdio.writeln cannot deduce function from argument types !()(string, void)

As it should, because reverse returns nothing, void.
But you may wonder what the design choice behind that was that reverse doesn't return the range itself while sort does (a SortedRange, specifically).


More information about the Digitalmars-d-learn mailing list