import std.algorithm : sort; assert(sortingPredicate!(typeof([1].sort!"a < b"))(1, 2) == true); assert(sortingPredicate!(typeof([1].sort!"a > b"))(1, 2) == false); assert(sortingPredicate!(typeof([1].sort!((a, b) => a < b)))(1, 2) == true); assert(sortingPredicate!(typeof([1].sort!((a, b) => a > b)))(1, 2) == false); assert(sortingPredicate!(int[])(1, 2) == true);
Given a SortedRange R, sortingPredicate!R(a, b) will call in to the * predicate that was used to create the SortedRange. * * Params: * Range = the range to extract the predicate from * fallbackPred = the sorting predicate to fallback to if Range is not a SortedRange