1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-26 02:20:30 +01:00

Never override hash(::T) -- always hash(::T, ::UInt)

This commit is contained in:
kalmar 2017-01-25 15:40:50 +01:00
parent 7d5973b11c
commit de4d91a56a

View File

@ -96,7 +96,10 @@ end
freegroup_reduce(W::GWord) = freegroup_reduce!(deepcopy(W)) freegroup_reduce(W::GWord) = freegroup_reduce!(deepcopy(W))
hash{T}(W::GWord{T}) = (W.modified && freegroup_reduce!(W); W.savedhash) function hash{T}(W::GWord{T}, h::UInt)
W.modified && freegroup_reduce!(W)
return W.savedhash) + h
end
function (==){T}(W::GWord{T}, Z::GWord{T}) function (==){T}(W::GWord{T}, Z::GWord{T})
W.modified && freegroup_reduce!(W) # reduce clears the flag and recalculate the hash W.modified && freegroup_reduce!(W) # reduce clears the flag and recalculate the hash