I noticed that both UnsafePointer and UnsafeMutablePointer have the identical 
method

    public func withMemoryRebound<T, Result>(to: T.Type, capacity count: Int, _ 
body: (UnsafeMutablePointer<T>) throws -> Result) rethrows -> Result

so that rebinding an immutable pointer gives you a _mutable_ pointer. That is 
different from what

    Unsafe[Mutable]Pointer<Pointee> {
      func withMemoryRebound<T>(to: T.Type, capacity count: Int,
        _ body: (Unsafe[Mutable]Pointer<T>) throws -> ()) rethrows
    }

in 
https://github.com/apple/swift-evolution/blob/master/proposals/0107-unsaferawpointer.md
 indicates. Perhaps I am misunderstanding something. Shouldn't rebinding an 
UnsafePointer result in an UnsafePointer again?

Martin

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Reply via email to