import std.algorithm: sort; // As a type assert(sortingPredicate!(typeof([1].sort!"a < b"))(1, 2) == true); assert(sortingPredicate!(typeof([1].sort!((a, b) => a > b)))(1, 2) == false); // As a value assert(sortingPredicate!([1].sort!"a > b")(1, 2) == false); assert(sortingPredicate!([1].sort!((a, b) => a < b))(1, 2) == true); // Default predicate 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