Skip to content

Commit 1924941

Browse files
author
Dave Abrahams
authored
Merge pull request #646 from apple/data-associated-type-fixes
Fixes for associated types of Data
2 parents 618f82d + a001a8f commit 1924941

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Foundation/Data.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
149149
public typealias Base64DecodingOptions = NSData.Base64DecodingOptions
150150

151151
public typealias Index = Int
152-
public typealias Indices = DefaultRandomAccessIndices<Data>
152+
public typealias Indices = CountableRange<Int>
153153

154154
internal var _wrapped : _SwiftNSData
155155

@@ -652,9 +652,9 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
652652
}
653653
}
654654

655-
public subscript(bounds: Range<Index>) -> MutableRandomAccessSlice<Data> {
655+
public subscript(bounds: Range<Index>) -> MutableRangeReplaceableRandomAccessSlice<Data> {
656656
get {
657-
return MutableRandomAccessSlice(base: self, bounds: bounds)
657+
return MutableRangeReplaceableRandomAccessSlice(base: self, bounds: bounds)
658658
}
659659
set {
660660
replaceSubrange(bounds, with: newValue.base)
@@ -680,6 +680,11 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
680680
public func index(after i: Index) -> Index {
681681
return i + 1
682682
}
683+
684+
685+
public var indices: CountableRange<Int> {
686+
return startIndex..<endIndex
687+
}
683688

684689
/// An iterator over the contents of the data.
685690
///

0 commit comments

Comments
 (0)