On 5/28/13 4:16 AM, Timothee Cour wrote:
very often I would wish that sort (+ related functions) could take unaryFun arguments and convert them to binaryFun as follows://pseudocode: template unaryToBinaryComp(alias foo) { bool unaryToBinaryComp(T)(T a, T b) if (__traits(compiles,foo(a) < foo(b)) ) { return foo(a) < foo(b); } }
I actually have a branch in my code that does exactly that. I abandoned it because the code, error messages, and documentation got really confusing.
It may be worth to add a keySort algorithm that only works with unary keys, but then I thought people can always write a small lambda.
Andrei
