I have many mixed composite-type instances that I need to compare their equality (by ===
) when I don’t necessarily (want to) have access to them directly.
I do not want to directly store a reference (like Ref
or a struct
) pointing to the original object because, I would have to manually free these references to allow garbage collection.
So far, what I have done is storing the hash values of them using objectid
in separate containers for comparison. However, I would like to avoid possible hash collision so that I can guarantee the equality of two objects when their hash codes (or other homogenous identifiers that are not strictly hash codes) are the same.
Is there any efficient way to achieve this? Thanks very much!