I have a custom type, and I defined == for it. I’m trying to delete! one member in a OrderedDict but it doesn’t work. I traced down the problem to the following behavior:
using DataStructures
import Base: ==
n = 2
type A
x::Int
end
==(a1::A, a2::A) = a1.x == a2.x
a = OrderedSet(A(i - 3) for i = 1:n)
a1 = A(-2)
@assert a1 == a[1] # checks out
@assert hash(a1) == hash(a[1]) # doesn't!
So why does the hash of a1 and a[1] not the same? Or how can I delete! things that are ==?
Thanks!