ordering predicate for ((array[i], value)) pairs.
// sorted: a < b auto a = [0, 1, 2, 3, 4, 6]; auto i = a.transitionIndex(2); assert(i == 2); auto lowerBound = a[0 .. i]; auto j = a.transitionIndex!"a <= b"(2); assert(j == 3); auto upperBound = a[j .. $]; assert(a.transitionIndex(a[$ - 1]) == a.length - 1); assert(a.transitionIndex!"a <= b"(a[$ - 1]) == a.length);
Computes transition index using binary search. It is low-level API for lower and upper bounds of a sorted array.