How can I get the memory address of a value type or a custom struct in Swift?

后端 未结 3 631
一整个雨季
一整个雨季 2021-02-04 08:08

I\'m trying to gain a deeper understanding of how Swift copies value types:

The behavior you see in your code will always be as if a copy took place. Ho

3条回答
  •  礼貌的吻别
    2021-02-04 08:27

    Swift 2.0 :

    You can use this unsafeAddressOf(someObject)

    or in Swift 3.0:

    use withUnsafePointer(to: someObejct) { print("\($0)") }

提交回复
热议问题