minIndex

fnptrdiff_t minIndex(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 minimum element.

Parameters

predThe ordering predicate to use to determine the minimum element.
rangeThe input range to search. Complexity: range.length Exactly range.length - 1 comparisons are needed.

Returns

The index of the first encounter of the minimum element in 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.

See Also