[stdlib] swapAt method (#9119)

* Add swapAt method

* Migrate sorting to swapAt

* Migrate further stdlib usage
This commit is contained in:
Ben Cohen
2017-04-29 11:55:00 -07:00
committed by GitHub
parent 0f24c5c34e
commit 1163ea7c7a
8 changed files with 36 additions and 20 deletions

View File

@@ -642,7 +642,7 @@ extension Sequence {
var result = Array(self)
let count = result.count
for i in 0..<count/2 {
swap(&result[i], &result[count - ((i + 1) as Int)])
result.swapAt(i, count - ((i + 1) as Int))
}
return result
}