sort

func sort<T : Comparable>(inout: [T])

Declaration

func sort<T : Comparable>(inout array: [T])
func sort<T : Comparable>(inout: ContiguousArray<T>)

Declaration

func sort<T : Comparable>(inout array: ContiguousArray<T>)
func sort<T>(inout: [T], isOrderedBefore: (T, T) -> Bool)

Declaration

func sort<T>(inout array: [T], isOrderedBefore: (T, T) -> Bool)
func sort<T>(inout: ContiguousArray<T>, isOrderedBefore: (T, T) -> Bool)

Declaration

func sort<T>(inout array: ContiguousArray<T>, isOrderedBefore: (T, T) -> Bool)
func sort<C : MutableCollectionType where C.Index : RandomAccessIndexType, C.Generator.Element : Comparable>(inout: C)

Sort collection in-place.

The sorting algorithm is not stable (can change the relative order of elements that compare equal).

Requires: The less-than operator (func <) defined in the Comparable conformance is a strict weak ordering over elements.

Declaration

func sort<C : MutableCollectionType where C.Index : RandomAccessIndexType, C.Generator.Element : Comparable>(inout collection: C)
func sort<C : MutableCollectionType where C.Index : RandomAccessIndexType>(inout: C, isOrderedBefore: (C.Generator.Element, C.Generator.Element) -> Bool)

Sort collection in-place according to isOrderedBefore.

The sorting algorithm is not stable (can change the relative order of elements for which isOrderedBefore does not establish an order).

Requires: isOrderedBefore is a strict weak ordering over elements.

Declaration

func sort<C : MutableCollectionType where C.Index : RandomAccessIndexType>(inout collection: C, isOrderedBefore: (C.Generator.Element, C.Generator.Element) -> Bool)