Re-order the given range
of elements
and return a pivot index
p.
Postcondition: for all i in range.startIndex..<
p, and j
in p..<range.endIndex
, less(elements[
i],
elements[
j]) && !less(elements[
j],
elements[
p])
. Only returns range.endIndex
when
elements
is empty.
Requires: The less-than operator (func <
) defined in the Comparable
conformance is a strict weak ordering
over elements
.
Declaration
func partition<C : MutableCollectionType where C.Index : RandomAccessIndexType, C.Generator.Element : Comparable>(inout elements: C, range: Range<C.Index>) -> C.Index