Last active
May 15, 2020 20:34
-
-
Save anupamchugh/ab7d981fc138caf6bc2c7ad7ee055db8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func address(o: UnsafeRawPointer) -> NSString { | |
let addr = Int(bitPattern: o) | |
return NSString(format: "%p", addr) | |
} | |
struct Point { | |
var p: Int | |
} | |
var pointA = [Point(p: 25), Point(p: 20)] | |
var pointB = pointA | |
//pointA and pointB have the same address | |
pointA[0].p = 10 | |
//now a deep copy of pointA takes place | |
//pointB has a new address |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment