UnsafeBufferPointer should be Slicable
| Originator: | robnapier | ||
| Number: | rdar://21579432 | Date Originated: | 27-Jun-2015 12:33 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Swift 2b2 |
| Classification: | Enhancement | Reproducible: | Not Applicable |
extension UnsafeBufferPointer: Sliceable {
public subscript (bounds: Range<Index>) -> UnsafeBufferPointer<T> {
return(UnsafeBufferPointer(start: self.baseAddress + bounds.startIndex, count: bounds.count))
}
}
Since UnsafeBufferPointer is intended to provide a Collection interface, and it is efficiently Sliceable, it makes sense to make it Sliceable.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!