sorted

func sorted<C : SequenceType where C.Generator.Element : Comparable>(_: C)

Return an Array containing the sorted elements of source{according}.

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 sorted<C : SequenceType where C.Generator.Element : Comparable>(source: C) -> [C.Generator.Element]
func sorted<C : SequenceType>(_: C, isOrderedBefore: (C.Generator.Element, C.Generator.Element) -> Bool)

Return an Array containing the sorted elements of source{according}.

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 sorted<C : SequenceType>(source: C, isOrderedBefore: (C.Generator.Element, C.Generator.Element) -> Bool) -> [C.Generator.Element]