Skip to content

Instantly share code, notes, and snippets.

@natecook1000
Created September 13, 2017 15:34
Show Gist options
  • Save natecook1000/edb646fef86801d8106e9a214637a284 to your computer and use it in GitHub Desktop.
Save natecook1000/edb646fef86801d8106e9a214637a284 to your computer and use it in GitHub Desktop.
extension Dictionary {
var storageID: UInt {
var copy = self
return withUnsafeBytes(of: &copy) {
$0.baseAddress!.load(as: UInt.self)
}
}
}
var a = [1: 1, 2: 2]
var b = a
print(a.storageID == b.storageID) // true
b[3] = 3
print(a.storageID == b.storageID) // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment