Skip to content

Commit

Permalink
Add compat annotation for sorting NTuples. (#56961)
Browse files Browse the repository at this point in the history
Thanks @stevengj for pointing this out
#54494 (comment)
  • Loading branch information
LilithHafner authored Jan 6, 2025
1 parent 7801351 commit 5058dba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion base/sort.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1739,10 +1739,13 @@ function sort!(v::AbstractVector{T};
end

"""
sort(v; alg::Base.Sort.Algorithm=Base.Sort.defalg(v), lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward)
sort(v::Union{AbstractVector, NTuple}; alg::Base.Sort.Algorithm=Base.Sort.defalg(v), lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward)
Variant of [`sort!`](@ref) that returns a sorted copy of `v` leaving `v` itself unmodified.
!!! compat "Julia 1.12"
Sorting `NTuple`s requires Julia 1.12 or later.
# Examples
```jldoctest
julia> v = [3, 1, 2];
Expand Down

0 comments on commit 5058dba

Please sign in to comment.