I want to compare the addresses of two Swift objects, like:
let a: AnyObject
let b: AnyObject
a < b
Of course this is not possible like this but I’m not able to find any way to achieve this.
I could just implement a C function to do this
bool compare(NSObject *a, NSObject *b){
return a < b;
}
and then call it like
compare(a, b)
but this limits me to use NSObjects
.
So my question is: Is there any way to achieve this purely in Swift?