I would like to have a Dictionary
whose key type is a class type. Dictionaries require their keys to be Hashable
.
In my case, the instances of that class type compare equal if they are reference-equal (they share their memory location). Is there a way that I can implement the Hashable
protocol's hashValue
based on the object's memory address?
In Swift 2, this could be done by using Unmanaged.toOpaque
, however that method is gone in the first Swift 3 preview.