phobos/changelog/std-algorithm-searching-maxindex.dd
2017-01-06 23:38:04 +01:00

13 lines
401 B
Text

Added `std.algorithm.searching.maxIndex` to get the index of the maximum element of a range.
`std.algorithm.searching.maxIndex` gets the index of the maximum element of a range,
according to a specified predicate. The default predicate is "a > b".
-------
import std.algorithm.searching : maxIndex;
int[] a = [5, 4, 2, 1, 9, 10];
assert(a.minIndex == 5);
int[] a;
assert(a.minIndex == -1);
-------