range. If the
range is empty, -1 is returned.
Limitations: If at least one of the arguments is NaN, the result is an unspecified value. See maxElement for examples on how to cope with NaNs.
ptrdiff_t maxIndex(alias pred = "a < b", Range)(Range range) if (isInputRange!Range && !isInfinite!Range &&
is(typeof(binaryFun!pred(range.front, range.front))))Computes the index of the first occurrence of range's maximum element.
Complexity: range Exactly range.length - 1 comparisons are needed.
pred | The ordering predicate to use to determine the maximum element. |
range | The input range to search. |
range. If the
range is empty, -1 is returned.
Limitations: If at least one of the arguments is NaN, the result is an unspecified value. See maxElement for examples on how to cope with NaNs.