Skip to content

Commit 942b843

Browse files
martinholtersmbauman
authored andcommitted
Add deprecated ind2sub(::NTuple{N,Integer}, ::CartesianIndex{N}) (#23708)
Makes the return type change of #22907 less breaking by allowing the common pattern `ind2sub(size(a), indmax(a))` to still work.
1 parent b752b87 commit 942b843

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

base/deprecated.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,10 @@ import .Iterators.enumerate
18221822
return p
18231823
end
18241824

1825+
# ease transition for return type change of e.g. indmax due to PR #22907 when used in the
1826+
# common pattern `ind2sub(size(a), indmax(a))`
1827+
@deprecate(ind2sub(dims::NTuple{N,Integer}, idx::CartesianIndex{N}) where N, Tuple(idx))
1828+
18251829
@deprecate contains(eq::Function, itr, x) any(y->eq(y,x), itr)
18261830

18271831
# PR #23690

0 commit comments

Comments
 (0)