|
absl's Hash::combine functions are already hashing.
What we're doing is adding a tenantId's hash to the hash,
which is hashing twice.
std::size_t hash() const {
|
return OID::Hasher()(_oid);
|
}
|
|
/**
|
* Functor compatible with std::hash for std::unordered_{map,set}
|
*/
|
struct Hasher {
|
std::size_t operator()(const TenantId& tenantId) const {
|
return tenantId.hash();
|
}
|
};
|
|
/**
|
* Hash function compatible with absl::Hash for absl::unordered_{map,set}
|
*/
|
template <typename H>
|
friend H AbslHashValue(H h, const TenantId& tenantId) {
|
return H::combine(std::move(h), tenantId.hash());
|
}
|
The idiom for absl's composable hashing would be that you combine the _oid directly to h and then OID would have its own AbslHashValue nonmember function that ultimately combines in the bytes of the _oid as a range.
|