> On May 9, 2016, at 1:23 PM, Xiaodi Wu <[email protected]> wrote:
>
> Along similar lines, with the indexing model change, isn't the following
> outdated?
Yes. Thanks. I’m working on updating both the proposal and implementation.
-Andy
>
> ```
> extension UnsafeBytePointer : RandomAccessIndex {
> typealias Distance = Int
>
> func successor() -> UnsafeBytePointer
> func predecessor() -> UnsafeBytePointer
> func distance(to : UnsafeBytePointer) -> Int
> func advanced(by : Int) -> UnsafeBytePointer
> }
> ```
>
>
> On Mon, May 9, 2016 at 3:20 PM, Joe Groff via swift-evolution
> <[email protected] <mailto:[email protected]>> wrote:
> Regarding the UnsafeBytePointer API:
>
>> struct UnsafeBytePointer : Hashable, _Pointer {
>>
>> let _rawValue: Builtin.RawPointer
>>
>> var hashValue: Int {...}
>>
>> init<T>(_ : UnsafePointer<T>)
>> init<T>(_ : UnsafeMutablePointer<T>)
>> init?<T>(_ : UnsafePointer<T>?)
>> init?<T>(_ : UnsafeMutablePointer<T>?)
>>
>> init<T>(_ : OpaquePointer<T>)
>> init?<T>(_ : OpaquePointer<T>?)
>>
>> init?(bitPattern: Int)
>> init?(bitPattern: UInt)
>>
>> func load<T>(_ : T.Type) -> T
>>
>> @warn_unused_result
>> init(allocatingBytes size: Int, alignedTo: Int)
>>
>> @warn_unused_result
>> init<T>(allocatingCapacity count: Int, of: T.Type)
>>
>> func deallocateBytes(_ size: Int, alignedTo: Int)
>>
>> func deallocateCapacity<T>(_ num: Int, of: T.Type)
>>
>> // Returns a pointer one byte after the initialized memory.
>> func initialize<T>(with newValue: T, count: Int = 1) -> UnsafeBytePointer
>>
>> // Returns a pointer one byte after the initialized memory.
>> func initialize<T>(from: UnsafePointer<T>, count: Int) -> UnsafeBytePointer
>>
>> func initializeBackward<T>(from source: UnsafePointer<T>, count: Int)
>>
>> func deinitialize<T>(_ : T.Type, count: Int = 1)
>> }
>
> Should we also have 'assign' methods, matching 'initialize'? Should
> 'deinitialize' be called 'destroy', matching 'UnsafeMutablePointer's API?
>
> -Joe
>
> _______________________________________________
> swift-evolution mailing list
> [email protected] <mailto:[email protected]>
> https://lists.swift.org/mailman/listinfo/swift-evolution
> <https://lists.swift.org/mailman/listinfo/swift-evolution>
>
>
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution