Skip to content

Commit ab28882

Browse files
committed
Add deprecated ind2sub(::NTuple{N,Integer}, ::CartesianIndex{N})
Makes the return type change of #22907 less breaking by allowing the common pattern `ind2sum(size(a), indmax(a))` to still work.
1 parent deceb3b commit ab28882

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

base/deprecated.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,6 +1806,11 @@ import .Iterators.enumerate
18061806
return p
18071807
end
18081808

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

18111816
# BEGIN 1.0 deprecations

0 commit comments

Comments
 (0)