Yes, Rien, just realised that. Now I must find some place to hide in
shame…
Thanks for your reply, though!
milos
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users
If you change the “==“ function to:
func == (lhs: X, rhs: X) -> Bool {
return (lhs.x == rhs.x) && (lhs.hashValue == rhs.hashValue)
}
then the example works as expected.
Apple says this: “A hash value, provided by a type’s hashValue property, is an
integer that is the same for any two
Given an array of instances of a `Hashable` value type, all equal
according to `Equatable` protocol, but with distinct `hashValue`s, I
would expect that initialising a set with that array would preserve all
the instances. Instead, running the code below in an iOS playground on
Xcode 8.0