diff --git a/changelog.dd b/changelog.dd index d9713da8b05..cf2fee8d59c 100644 --- a/changelog.dd +++ b/changelog.dd @@ -10,6 +10,11 @@ $(BUGSTITLE Library Changes, in multi-term arithmetic expressions.)) $(LI $(RELATIVE_LINK2 staticIsSorted, Added `std.meta.staticIsSorted` to check if an `AliasSeq` is sorted according to some template predicate.)) + $(LI $(RELATIVE_LINK2 minIndex, Added `std.algorithm.searching.minIndex` + to get the index of the minimum element of a range.)) + $(LI $(RELATIVE_LINK2 maxIndex, Added `std.algorithm.searching.maxIndex` + to get the index of the maximum element of a range.)) + ) $(BUGSTITLE Library Changes, @@ -40,6 +45,32 @@ static assert(!staticIsSorted!(Comp, bool, long, dchar)); minimize such use.) ) +$(LI $(LNAME2 minIndex, `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); +------- +) + +$(LI $(LNAME2 maxIndex, `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); +------- +) + ) Macros: