mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[stdlib] swapAt method (#9119)
* Add swapAt method * Migrate sorting to swapAt * Migrate further stdlib usage
This commit is contained in:
@@ -165,7 +165,7 @@ extension MutableCollection {
|
||||
var i = index(after: pivot)
|
||||
while i < endIndex {
|
||||
if try !belongsInSecondPartition(self[i]) {
|
||||
swap(&self[i], &self[pivot])
|
||||
swapAt(i, pivot)
|
||||
formIndex(after: &pivot)
|
||||
}
|
||||
formIndex(after: &i)
|
||||
@@ -217,7 +217,7 @@ extension MutableCollection where Self : BidirectionalCollection {
|
||||
break Loop
|
||||
} while false
|
||||
|
||||
swap(&self[lo], &self[hi])
|
||||
swapAt(lo, hi)
|
||||
formIndex(after: &lo)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user