stablePartition(subrange:by:)

Moves all elements satisfying the given predicate into a suffix of the given range, preserving the relative order of the elements in both partitions, and returns the start of the resulting suffix.

Partition.swift:61
mutating func stablePartition(subrange: Range<Index>, by belongsInSecondPartition: (Element) throws -> Bool) rethrows -> Index

Parameters

subrange

The range of elements within this collection to partition.

belongsInSecondPartition

A predicate used to partition the collection. All elements satisfying this predicate are ordered after all elements not satisfying it.