Skip to content

Instantly share code, notes, and snippets.

@elliottwilliams
Created February 20, 2018 15:58
Show Gist options
  • Save elliottwilliams/d17f043bb0fabf589aff919b75267535 to your computer and use it in GitHub Desktop.
Save elliottwilliams/d17f043bb0fabf589aff919b75267535 to your computer and use it in GitHub Desktop.
prefix operator *
protocol Dereferencable {
associatedtype DereferencablePointee
static prefix func * (pointer: Self) -> DereferencablePointee
}
extension UnsafePointer: Dereferencable {
typealias DereferencablePointee = Pointee
static prefix func * (pointer: UnsafePointer) -> Pointee {
return pointer.pointee
}
}
func foo<T>(p: UnsafePointer<T>) {
let t = *p
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment