isSorted

fnbool isSorted(alias less = "a < b", Range)(Range r) if (isForwardRange!(Range))

Checks whether a forward range is sorted according to the comparison operation less. Performs r.length evaluations of less.

Unlike isSorted, isStrictlyMonotonic does not allow for equal values, i.e. values for which both less(a, b) and less(b, a) are false.

With either function, the predicate must be a strict ordering just like with isSorted. For example, using "a <= b" instead of "a < b" is incorrect and will cause failed assertions.

Parameters

lessPredicate the range should be sorted by.
rForward range to check for sortedness.

Returns

true if the range is sorted, false otherwise. isSorted allows

duplicates, isStrictlyMonotonic not.