[WIP] Sort function in Swift
🚧 This post is under construction 🚧
[_introSortImpl
func _introSortImpl<C>(
_ elements: inout C,
subRange range: Range<C.Index>
${", by areInIncreasingOrder: (C.Iterator.Element, C.Iterator.Element) -> Bool" if p else ""},
depthLimit: Int
) where
C : MutableCollection & RandomAccessCollection
${"" if p else ", C.Iterator.Element : Comparable"}
swift/stdlib/public/core/CollectionAlgorithms.swift.gyb swift/stdlib/public/core/Sort.swift.gyb Swift sorting algorithm implementation
- Arrays.swift.gyb -> Arrays.swift after running build-script -x.
- In Arrays.swift, there are
struct Array<Element>
,struct ContiguousArray<Element>
,struct ArraySlice<Element>
. sorted()
,sort()
functions are defined inMutableCollection
,Sequence
protocols.