mirror of
https://github.com/dlang/phobos.git
synced 2025-05-05 09:30:49 +03:00
13 lines
401 B
Text
13 lines
401 B
Text
Added `std.algorithm.searching.minIndex` to get the index of the minimum element of a range.
|
|
|
|
`std.algorithm.searching.minIndex` gets the index of the minimum element of a range,
|
|
according to a specified predicate. The default predicate is "a < b".
|
|
|
|
-------
|
|
import std.algorithm.searching : minIndex;
|
|
int[] a = [5, 4, 2, 1, 9, 10];
|
|
assert(a.minIndex == 3);
|
|
|
|
int[] a;
|
|
assert(a.minIndex == -1);
|
|
-------
|