MutableCollection (ext)
You’re viewing third-party extensions to MutableCollection
, a protocol from the Swift standard library.
You can also read the documentation forMutableCollection
itself.
extension MutableCollection
You’re viewing third-party extensions to MutableCollection
, a protocol from the Swift standard library.
You can also read the documentation forMutableCollection
itself.
extension MutableCollection
protocol MutableCollection<Element> : Collection where Self.SubSequence : MutableCollection
A collection that supports subscript assignment.
import Algorithms
Swift Algorithms is an open-source package of sequence and collection algorithms, along with their related types.
mutating func partition(subrange: Range<Index>, by belongsInSecondPartition: (Element) throws -> Bool) rethrows -> Index
Moves all elements satisfying isSuffixElement
into a suffix of the collection, returning the start position of the resulting suffix.
@discardableResult mutating func rotate(subrange: Range<Index>, toStartAt newStart: Index) -> Index
Rotates the elements within the given subrange so that the element at the specified index becomes the start of the subrange.
@discardableResult mutating func rotate(toStartAt newStart: Index) -> Index
Rotates the elements of this collection so that the element at the specified index becomes the start of the collection.
mutating func stablePartition(by belongsInSecondPartition: (Element) throws -> Bool) rethrows -> Index
Moves all elements satisfying the given predicate into a suffix of this collection, preserving the relative order of the elements in both partitions, and returns the start of the resulting suffix.
mutating func stablePartition(subrange: Range<Index>, by belongsInSecondPartition: (Element) throws -> Bool) rethrows -> Index
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.
protocol BidirectionalCollection<Element> : Collection where Self.Indices : BidirectionalCollection, Self.SubSequence : BidirectionalCollection
A collection that supports backward as well as forward traversal.
mutating func partition(subrange: Range<Index>, by belongsInSecondPartition: (Element) throws -> Bool) rethrows -> Index
Moves all elements satisfying isSuffixElement
into a suffix of the collection, returning the start position of the resulting suffix.
mutating func reverse(subrange: Range<Index>)
Reverses the elements within the given subrange.
@discardableResult mutating func rotate(subrange: Range<Index>, toStartAt newStart: Index) -> Index
Rotates the elements within the given subrange so that the element at the specified index becomes the start of the subrange.
@discardableResult mutating func rotate(toStartAt newStart: Index) -> Index
Rotates the elements of this collection so that the element at the specified index becomes the start of the collection.