Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change findfirst/findlast/findnext/findprev to return the same index type as keys() #25577

Merged
merged 2 commits into from
Jan 18, 2018

Commits on Jan 16, 2018

  1. 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.
    nalimilan committed Jan 16, 2018
    Configuration menu
    Copy the full SHA
    8658ad2 View commit details
    Browse the repository at this point in the history
  2. 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.
    nalimilan committed Jan 16, 2018
    Configuration menu
    Copy the full SHA
    80e4d44 View commit details
    Browse the repository at this point in the history