It looks like you’re missing a definition of Base.hash
for your type. From the documentation for isequal
(which you can read by typing ?isequal
):
isequal is the comparison function used by hash tables (Dict). isequal(x,y) must imply that hash(x) == hash(y).
Since your isequal
and ==
tests just check the v
member, you can do the same for hashing:
julia> Base.hash(v::my_vector, seed::UInt) = hash(v.v, seed)
Also, please quote your code so that it is easier to read. You can find some helpful instructions on how to do that here: Please read: make it easier to help you