mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[stdlib] More RandomAccessCollection conformances
I missed a few the first time around.
This commit is contained in:
@@ -532,7 +532,7 @@ public func += <
|
||||
}
|
||||
}
|
||||
|
||||
extension _ContiguousArrayBuffer : Collection {
|
||||
extension _ContiguousArrayBuffer : RandomAccessCollection {
|
||||
/// The position of the first element in a non-empty collection.
|
||||
///
|
||||
/// In an empty collection, `startIndex == endIndex`.
|
||||
|
||||
@@ -753,7 +753,7 @@ public struct DictionaryLiteral<Key, Value> : DictionaryLiteralConvertible {
|
||||
|
||||
/// `Collection` conformance that allows `DictionaryLiteral` to
|
||||
/// interoperate with the rest of the standard library.
|
||||
extension DictionaryLiteral : Collection {
|
||||
extension DictionaryLiteral : RandomAccessCollection {
|
||||
/// The position of the first element in a non-empty `DictionaryLiteral`.
|
||||
///
|
||||
/// Identical to `endIndex` in an empty `DictionaryLiteral`.
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
/// Buffer type for `ArraySlice<Element>`.
|
||||
public // @testable
|
||||
struct _SliceBuffer<Element> : _ArrayBufferProtocol {
|
||||
struct _SliceBuffer<Element> : _ArrayBufferProtocol, RandomAccessCollection {
|
||||
internal typealias NativeStorage = _ContiguousArrayStorage<Element>
|
||||
public typealias NativeBuffer = _ContiguousArrayBuffer<Element>
|
||||
|
||||
|
||||
@@ -571,7 +571,7 @@ public struct _StringCore {
|
||||
}
|
||||
}
|
||||
|
||||
extension _StringCore : Collection {
|
||||
extension _StringCore : RandomAccessCollection {
|
||||
public // @testable
|
||||
var startIndex: Int {
|
||||
return 0
|
||||
|
||||
@@ -238,7 +238,7 @@ extension UnicodeScalar {
|
||||
}
|
||||
}
|
||||
|
||||
extension UnicodeScalar.UTF16View : Collection {
|
||||
extension UnicodeScalar.UTF16View : RandomAccessCollection {
|
||||
/// The position of the first code unit.
|
||||
var startIndex: Int {
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user