using unaryFun in functions that take a comparator (eg sort etc): sort!"a[0]" <=> sort!"a[0]<b[0]"

David Nadlinger see at klickverbot.at
Tue May 28 06:22:12 PDT 2013


On Tuesday, 28 May 2013 at 08:16:47 UTC, Timothee Cour wrote:
> sort!"foo(a)" <=>sort!(unaryToBinaryComp!(unaryFun!"foo(a)"))
> <=> sort!"foo(a) < foo(a)"
> sorting in reverse order is easy: just use sort!"-foo(a)"

In this case, schwartzSort might actually be more appropriate.

But in general, I see your point.

David


More information about the Digitalmars-d mailing list