Skip to content

Commit 02f3418

Browse files
authored
Merge pull request #4960 from RazvanN7/Changelog_Issue_8573
Added changelog entries for min/maxIndex functions
2 parents 9965433 + cca8894 commit 02f3418

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

changelog.dd

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ $(BUGSTITLE Library Changes,
1010
in multi-term arithmetic expressions.))
1111
$(LI $(RELATIVE_LINK2 staticIsSorted, Added `std.meta.staticIsSorted` to check if
1212
an `AliasSeq` is sorted according to some template predicate.))
13+
$(LI $(RELATIVE_LINK2 minIndex, Added `std.algorithm.searching.minIndex`
14+
to get the index of the minimum element of a range.))
15+
$(LI $(RELATIVE_LINK2 maxIndex, Added `std.algorithm.searching.maxIndex`
16+
to get the index of the maximum element of a range.))
17+
1318
)
1419

1520
$(BUGSTITLE Library Changes,
@@ -40,6 +45,32 @@ static assert(!staticIsSorted!(Comp, bool, long, dchar));
4045
minimize such use.)
4146
)
4247

48+
$(LI $(LNAME2 minIndex, `std.algorithm.searching.minIndex` gets the index of
49+
the minimum element of a range, according to a specified predicate. The
50+
default predicate is "a < b")
51+
-------
52+
import std.algorithm.searching : minIndex;
53+
int[] a = [5, 4, 2, 1, 9, 10];
54+
assert(a.minIndex == 3);
55+
56+
int[] a;
57+
assert(a.minIndex == -1);
58+
-------
59+
)
60+
61+
$(LI $(LNAME2 maxIndex, `std.algorithm.searching.maxIndex` gets the index of
62+
the maximum element of a range, according to a specified predicate. The
63+
default predicate is "a > b")
64+
-------
65+
import std.algorithm.searching : maxIndex;
66+
int[] a = [5, 4, 2, 1, 9, 10];
67+
assert(a.minIndex == 5);
68+
69+
int[] a;
70+
assert(a.minIndex == -1);
71+
-------
72+
)
73+
4374
)
4475

4576
Macros:

0 commit comments

Comments
 (0)