Adopt safe addressors in Swift's Array family of types.

rdar://190323998

Swift SVN r24599
This commit is contained in:
John McCall
2015-01-21 09:12:49 +00:00
parent bd1adebdd8
commit 3be27ad22b
8 changed files with 106 additions and 6 deletions

View File

@@ -270,6 +270,10 @@ public struct _ContiguousArrayBuffer<T> : _ArrayBufferType {
return isUniquelyReferenced()
}
public mutating func isMutableAndUniquelyReferencedOrPinned() -> Bool {
return isUniquelyReferencedOrPinned()
}
/// If this buffer is backed by a `_ContiguousArrayBuffer`
/// containing the same number of elements as `self`, return it.
/// Otherwise, return `nil`.
@@ -381,6 +385,13 @@ public struct _ContiguousArrayBuffer<T> : _ArrayBufferType {
return __bufferPointer.holdsUniqueReference()
}
/// Return true iff this buffer's storage is either
/// uniquely-referenced or pinned. NOTE: this does not mean
/// the buffer is mutable; see the comment on isUniquelyReferenced.
public mutating func isUniquelyReferencedOrPinned() -> Bool {
return __bufferPointer.holdsUniqueOrPinnedReference()
}
#if _runtime(_ObjC)
/// Convert to an NSArray.
/// Precondition: T is bridged to Objective-C