ORIGINAL
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
original::hash< TYPE > Class Template Reference

Generic hash function object supporting multiple types. More...

#include <hash.h>

Collaboration diagram for original::hash< TYPE >:
Collaboration graph

Public Member Functions

u_integer operator() (const TYPE &t) const noexcept
 Hash function object call operator.
 
template<typename T >
original::u_integer hashFuncImpl (const T &t) noexcept
 
template<typename T >
original::u_integer hashFunc (const T &t) noexcept
 
template<typename T >
original::u_integer hashFunc (T *const &t) noexcept
 

Static Public Member Functions

template<typename T >
static void hashCombine (u_integer &seed, const T &value) noexcept
 Combines a hash value with another value's hash.
 
static u_integer fnv1a (const byte *data, u_integer size) noexcept
 FNV-1a hash implementation for raw byte data.
 
template<typename T , typename... Rest>
static void hashCombine (u_integer &seed, const T &value, const Rest &... rest) noexcept
 Combines multiple hash values into one.
 
template<typename T >
static u_integer hashFunc (const T &t) noexcept
 Default hash function fallback.
 
template<HashTraits T>
static u_integer hashFunc (const T &t) noexcept
 Hash function for types implementing HashTraits concept.
 
template<std::integral T>
static u_integer hashFunc (const T &t) noexcept
 Hash function specialization for integral types.
 
template<typename T >
static u_integer hashFunc (T *const &t) noexcept
 Hash function for pointers.
 
static u_integer hashFunc (const std::nullptr_t &null) noexcept
 Hash function for nullptr.
 
static u_integer hashFunc (const char &t) noexcept
 Hash function for single character.
 
static u_integer hashFunc (const char *str) noexcept
 Hash function for C-style strings.
 
static u_integer hashFunc (const std::string &str) noexcept
 Hash function for std::string.
 

Static Public Attributes

static constexpr u_integer FNV_OFFSET_BASIS = 0x811C9DC5
 FNV-1a initial offset value (0x811C9DC5)
 
static constexpr u_integer FNV_32_PRIME = 0x01000193
 FNV-1a prime multiplier (0x01000193)
 

Friends

template<typename >
class hashable
 

Detailed Description

template<typename TYPE>
class original::hash< TYPE >

Generic hash function object supporting multiple types.

Template Parameters
TYPEThe type for which the hash function object is defined

Provides:

Supported Types:

Example Usage:

u_integer h = hasher("hello world");
Unique ownership smart pointer with move semantics.
Definition ownerPtr.h:37

Member Function Documentation

◆ fnv1a()

template<typename TYPE >
original::u_integer original::hash< TYPE >::fnv1a ( const byte data,
u_integer  size 
)
staticnoexcept

FNV-1a hash implementation for raw byte data.

Parameters
dataPointer to byte array
sizeNumber of bytes to hash
Returns
Computed hash value
Note
This is the fundamental hashing operation used by other specializations

◆ hashCombine() [1/2]

template<typename TYPE >
template<typename T >
void original::hash< TYPE >::hashCombine ( u_integer seed,
const T &  value 
)
staticnoexcept

Combines a hash value with another value's hash.

Template Parameters
TType of the value to combine
Parameters
seedCurrent hash value (modified in-place)
valueValue whose hash to combine

◆ hashCombine() [2/2]

template<typename TYPE >
template<typename T , typename... Rest>
void original::hash< TYPE >::hashCombine ( u_integer seed,
const T &  value,
const Rest &...  rest 
)
staticnoexcept

Combines multiple hash values into one.

Template Parameters
TFirst value type
RestRemaining value types
Parameters
seedCurrent hash value (modified in-place)
valueFirst value to combine
restRemaining values to combine

◆ hashFunc() [1/8]

template<typename TYPE >
original::u_integer original::hash< TYPE >::hashFunc ( const char t)
staticnoexcept

Hash function for single character.

Parameters
tCharacter to hash
Returns
Integer value of the character

◆ hashFunc() [2/8]

template<typename TYPE >
original::u_integer original::hash< TYPE >::hashFunc ( const char str)
staticnoexcept

Hash function for C-style strings.

Parameters
strNull-terminated string
Returns
Computed FNV-1a hash
Note
Handles nullptr by returning 0

◆ hashFunc() [3/8]

template<typename TYPE >
original::u_integer original::hash< TYPE >::hashFunc ( const std::nullptr_t &  null)
staticnoexcept

Hash function for nullptr.

Parameters
nullNull pointer
Returns
0 as the hash value

◆ hashFunc() [4/8]

template<typename TYPE >
original::u_integer original::hash< TYPE >::hashFunc ( const std::string &  str)
staticnoexcept

Hash function for std::string.

Parameters
strString to hash
Returns
Computed FNV-1a hash

◆ hashFunc() [5/8]

template<typename TYPE >
template<typename T >
static u_integer original::hash< TYPE >::hashFunc ( const T &  t)
staticnoexcept

Default hash function fallback.

Template Parameters
TThe input type
Parameters
tThe value to be hashed
Returns
Hash value

For trivially copyable types: uses byte-wise FNV-1a For other types: falls back to address hashing

◆ hashFunc() [6/8]

template<typename TYPE >
template<HashTraits T>
static u_integer original::hash< TYPE >::hashFunc ( const T &  t)
staticnoexcept

Hash function for types implementing HashTraits concept.

Template Parameters
TType that satisfies HashTraits concept
Parameters
tThe object to hash
Returns
Hash value via toHash() method

This specialization is used for types that provide a toHash() method and support equality comparison, regardless of inheritance hierarchy. This includes types inheriting from hashable<T> and standalone types that meet the HashTraits requirements.

See also
HashTraits

◆ hashFunc() [7/8]

template<typename TYPE >
template<std::integral T>
static u_integer original::hash< TYPE >::hashFunc ( const T &  t)
staticnoexcept

Hash function specialization for integral types.

Template Parameters
TIntegral type
Parameters
tThe value to hash
Returns
The cast hash value

◆ hashFunc() [8/8]

template<typename TYPE >
template<typename T >
static u_integer original::hash< TYPE >::hashFunc ( T *const t)
staticnoexcept

Hash function for pointers.

Template Parameters
TThe pointee type
Parameters
tPointer to hash
Returns
Hash value based on address

◆ operator()()

template<typename TYPE >
original::u_integer original::hash< TYPE >::operator() ( const TYPE t) const
noexcept

Hash function object call operator.

Parameters
tThe object to hash
Returns
Result of hashFunc
Note
Provides consistent interface for use in STL containers

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