Skip to content

Commit 934b40c

Browse files
LilithHafnerLilith Hafner
andauthored
simplify index initialization (JuliaLang#45292)
Co-authored-by: Lilith Hafner <Lilith.Hafner@gmail.com>
1 parent 1ee1bbd commit 934b40c

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

base/sort.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,11 +1111,7 @@ function sortperm(v::AbstractVector;
11111111
end
11121112
end
11131113
end
1114-
ax = axes(v, 1)
1115-
p = similar(Vector{eltype(ax)}, ax)
1116-
for (i,ind) in zip(eachindex(p), ax)
1117-
p[i] = ind
1118-
end
1114+
p = copymutable(eachindex(v))
11191115
sort!(p, alg, Perm(ordr,v))
11201116
end
11211117

0 commit comments

Comments
 (0)