The Array
type in Swift has a member function called sort
, with its signature being sort(isOrderedBefore: (T, T) -> Bool)
. This fun
Wrap the global sort
, for example,
func my_sort<T>(arr: T[], pred: (T, T) -> Bool) -> T[] {
return sort(arr, pred)
}
Chris Lattner suggests qualifying the name of the global function with Swift's default namespace, Swift
. So you should be able to access the global version using: Swift.sort
.