Suppose there are some mutable struct
types with no fields, and with the default (fallback) equality and hashing methods. A value of such a type has its identity as its only quality. For example:
mutable struct A end
mutable struct B end
Looking for a generic AbstractDict
subtype with such fieldless types as keys and values. What’s a good way to implement such a dictionary type, assuming the special properties of the identity-only types may be exploited for achieving better performance.
To be specific, I’m asking for this:
"""
D{A, B} <: AbstractDict{A, B}
Both `A` and `B` is assumed to be a `mutable struct` type without any field, and with the default, identity-based, equality and default, objectid-based, hashing.
"""
struct D{A, B} <: AbstractDict{A, B}
# ...
end
# ...