Skip to content

Commit

Permalink
Add deprecated ind2sub(::NTuple{N,Integer}, ::CartesianIndex{N})
Browse files Browse the repository at this point in the history
Makes the return type change of #22907 less breaking by allowing the
common pattern `ind2sum(size(a), indmax(a))` to still work.
  • Loading branch information
martinholters committed Sep 14, 2017
1 parent deceb3b commit ab28882
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1806,6 +1806,11 @@ import .Iterators.enumerate
return p
end

# ease transition for return type change of e.g. indmax due to PR #22907 when used in the
# common pattern `ind2sub(size(a), indmax(a))`
@deprecate(ind2sub(dims::NTuple{N,Integer}, idx::CartesianIndex{N}) where N,
ntuple(n -> idx[n], Val{N}()))

# END 0.7 deprecations

# BEGIN 1.0 deprecations
Expand Down

0 comments on commit ab28882

Please sign in to comment.