template <typename KeyType, typename ObjType, typename HashType, HashType kNumBuckets>

struct DefaultHashTraits

Defined at line 234 of file ../../zircon/system/ulib/fbl/include/fbl/intrusive_hash_table.h

DefaultHashTraits defines a default implementation of traits used to

define the hash function for a hash table.

At a minimum, a class or a struct which is to be used to define the

hash traits of a hashtable must define...

GetHash : A static method which take a constant reference to an instance of

the container's KeyType and returns an instance of the container's

HashType representing the hashed value of the key. If the hash

table is configured to have a compile time number of buckets, then

the value returned must be on the range from

[0, Container::NumBuckets - 1]

DefaultHashTraits generates a compliant implementation of hash traits taking

its KeyType, ObjType, HashType and NumBuckets from template parameters. Users

of DefaultHashTraits only need to implement a static method of ObjType named

GetHash which takes a const reference to a KeyType and returns a HashType.

For hash tables configured to have a compile time defined number of buckets,

the default implementation will automatically mod by the number of buckets

given in the template parameters. If the user's hash function already

automatically guarantees that the returned hash value will be in the proper

range, they should implement their own hash traits to avoid the extra div/mod

operation.

Public Methods

HashType GetHash (const KeyType & key)

Defined at line 236 of file ../../zircon/system/ulib/fbl/include/fbl/intrusive_hash_table.h