API Documentation
Static Public Member Functions | List of all members
nkMaths::Hasher Class Referencefinal

Provides hashing capabilities. More...

Static Public Member Functions

template<typename T >
static unsigned long long hash (const T &element)
 
template<>
static unsigned long long hash (const nkMemory::String &element)
 
template<>
static unsigned long long hash (const nkMemory::StringView &element)
 
static unsigned long long combineHashes (unsigned long long hash0, unsigned long long hash1)
 
template<typename T , typename U >
static unsigned long long hashAndCombine (const T &element0, const U &element1)
 
template<typename T >
static unsigned long long combineIntoHash (unsigned long long hash0, const T &element1)
 

Detailed Description

Provides hashing capabilities.

Member Function Documentation

◆ hash() [1/3]

template<typename T >
static unsigned long long nkMaths::Hasher::hash ( const T &  element)
static

Basic hashing of an element.

Parameters
elementThe element to hash.
Returns
Hash of given element.
Remarks
Currently supports everything that std::hash supports.

◆ hash() [2/3]

template<>
static unsigned long long nkMaths::Hasher::hash ( const nkMemory::String element)
static

Specialization of hashing for a nkMemory string.

Parameters
elementThe element to hash.
Returns
Hash of given element.

◆ hash() [3/3]

template<>
static unsigned long long nkMaths::Hasher::hash ( const nkMemory::StringView element)
static

Specialization of hashing for a nkMemory string view.

Parameters
elementThe element to hash.
Returns
Hash of given element.

◆ combineHashes()

static unsigned long long nkMaths::Hasher::combineHashes ( unsigned long long  hash0,
unsigned long long  hash1 
)
static

Combines two hashes together.

Parameters
hash0The first hash to combine.
hash1The second hash to combine.
Returns
A new hash, combination of both arguments.

◆ hashAndCombine()

template<typename T , typename U >
static unsigned long long nkMaths::Hasher::hashAndCombine ( const T &  element0,
const U &  element1 
)
static

Hashes both arguments before combining them into a single hash.

Parameters
element0The first element to hash and combine.
element1The second argument to hash and combine.
Returns
A new hash, combination of both arguments once hashed.

◆ combineIntoHash()

template<typename T >
static unsigned long long nkMaths::Hasher::combineIntoHash ( unsigned long long  hash0,
const T &  element1 
)
static

Combines a new element into an already existing hash.

Parameters
hash0The existing hash to combine into.
element1The second argument to hash first, then combine.
Returns
A new hash, combination of both arguments.

The documentation for this class was generated from the following file: