let's say I have the following:
protocol P : Equatable { var uniqueID : Int { get } } struct A : P { var uniqueID = 1 } struct B : P { var uniqueID = 2 } func ==<T : P>(lhs:T , rhs:T) -> Bool { return lhs.uniqueID == rhs.uniqueID }
Now when I write the following:
let a = A() let b = B() let c = a == b
I got an error : the binary operator '==' cannot be applied to operands of type "A" and "B"
Is there any way to achieve this?
source share