Merge pull request #646 from apple/data-associated-type-fixes
Fixes for associated types of Data
diff --git a/Foundation/Data.swift b/Foundation/Data.swift
index 74d715e..d925fbc 100644
--- a/Foundation/Data.swift
+++ b/Foundation/Data.swift
@@ -149,7 +149,7 @@
public typealias Base64DecodingOptions = NSData.Base64DecodingOptions
public typealias Index = Int
- public typealias Indices = DefaultRandomAccessIndices<Data>
+ public typealias Indices = CountableRange<Int>
internal var _wrapped : _SwiftNSData
@@ -652,9 +652,9 @@
}
}
- public subscript(bounds: Range<Index>) -> MutableRandomAccessSlice<Data> {
+ public subscript(bounds: Range<Index>) -> MutableRangeReplaceableRandomAccessSlice<Data> {
get {
- return MutableRandomAccessSlice(base: self, bounds: bounds)
+ return MutableRangeReplaceableRandomAccessSlice(base: self, bounds: bounds)
}
set {
replaceSubrange(bounds, with: newValue.base)
@@ -680,6 +680,11 @@
public func index(after i: Index) -> Index {
return i + 1
}
+
+
+ public var indices: CountableRange<Int> {
+ return startIndex..<endIndex
+ }
/// An iterator over the contents of the data.
///