Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change findfirst/findlast/findnext/findprev to return the same index …
…type as keys() (#25577) * Change findfirst/findlast/findnext/findprev to return the same index type as keys() This is consistent with find(). We need to check whether the iterator is empty first, since calling first(keys(A)) may throw an error. Also add needed last(::EachStringIndex) and prevind(::AbstractArray, ::CartesianIndex) methods. * Use more generic approach for findfirst and findlast Also add tests, and remove @inferred calls which did not actually check whether functions were inferred, but only whether the equality test was. Change the _pairs() fallback to use Iterators.countfrom() so that an error is raised by findlast() rather than assuming the last index is typemax(Int), and use length() for iterators which support it so that findlast() works.
- Loading branch information