[stdlib] Restore signatures to use UnsafeMutableBufferPointer.

Resolves rdar://problem/21933004.
This commit is contained in:
Mark Lacey
2017-06-11 12:05:11 -07:00
parent 6223264ca2
commit b64551b853
6 changed files with 18 additions and 34 deletions

View File

@@ -168,9 +168,7 @@ extension MutableCollection where Self : BidirectionalCollection {
by belongsInSecondPartition: (Element) throws -> Bool
) rethrows -> Index {
let maybeOffset = try _withUnsafeMutableBufferPointerIfSupported {
(baseAddress, count) -> Int in
var bufferPointer =
UnsafeMutableBufferPointer(start: baseAddress, count: count)
(bufferPointer) -> Int in
let unsafeBufferPivot = try bufferPointer.partition(
by: belongsInSecondPartition)
return unsafeBufferPivot - bufferPointer.startIndex
@@ -365,9 +363,7 @@ extension MutableCollection
public mutating func sort() {
let didSortUnsafeBuffer: Void? =
_withUnsafeMutableBufferPointerIfSupported {
(baseAddress, count) -> Void in
var bufferPointer =
UnsafeMutableBufferPointer(start: baseAddress, count: count)
(bufferPointer) -> Void in
bufferPointer.sort()
return ()
}
@@ -443,9 +439,7 @@ ${orderingExplanation}
let didSortUnsafeBuffer: Void? =
try _withUnsafeMutableBufferPointerIfSupported {
(baseAddress, count) -> Void in
var bufferPointer =
UnsafeMutableBufferPointer(start: baseAddress, count: count)
(bufferPointer) -> Void in
try bufferPointer.sort(by: areInIncreasingOrder)
return ()
}