Skip to content

Commit

Permalink
ae.utils.array: Deprecate indexOfElement
Browse files Browse the repository at this point in the history
- It is redundant with indexOf.
- The name is unfortunate, and confusing cf. elementIndex.
  • Loading branch information
CyberShadow committed Jan 10, 2024
1 parent ffe1cfd commit 494bf51
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions utils/array.d
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,7 @@ unittest
assert([1, 2, 3].indexOf([2]) == 1);
}

/// Reimplementation of `std.algorithm.indexOf`,
/// but with no auto-decoding.
sizediff_t indexOfElement(T, D)(in T[] arr, auto ref const D val)
deprecated ptrdiff_t indexOfElement(T, D)(in T[] arr, auto ref const D val)
if (is(typeof(arr[0]==val)))
{
foreach (i, ref v; arr)
Expand All @@ -322,7 +320,7 @@ sizediff_t indexOfElement(T, D)(in T[] arr, auto ref const D val)
bool contains(T, V)(in T[] arr, auto ref const V val)
if (is(typeof(arr[0]==val)))
{
return arr.indexOfElement(val) >= 0;
return arr.indexOf(val) >= 0;
}

/// Ditto, for substrings
Expand Down

0 comments on commit 494bf51

Please sign in to comment.