ORIGINAL
|
Generic hash function object supporting multiple types. More...
#include <hash.h>
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 |
Generic hash function object supporting multiple types.
TYPE | The type for which the hash function object is defined |
Provides:
Supported Types:
Example Usage:
|
staticnoexcept |
FNV-1a hash implementation for raw byte data.
data | Pointer to byte array |
size | Number of bytes to hash |
|
staticnoexcept |
Combines a hash value with another value's hash.
T | Type of the value to combine |
seed | Current hash value (modified in-place) |
value | Value whose hash to combine |
|
staticnoexcept |
Combines multiple hash values into one.
T | First value type |
Rest | Remaining value types |
seed | Current hash value (modified in-place) |
value | First value to combine |
rest | Remaining values to combine |
|
staticnoexcept |
Hash function for single character.
t | Character to hash |
|
staticnoexcept |
Hash function for C-style strings.
str | Null-terminated string |
|
staticnoexcept |
Hash function for nullptr.
null | Null pointer |
|
staticnoexcept |
Hash function for std::string.
str | String to hash |
|
staticnoexcept |
Default hash function fallback.
T | The input type |
t | The value to be hashed |
For trivially copyable types: uses byte-wise FNV-1a For other types: falls back to address hashing
|
staticnoexcept |
Hash function for types implementing HashTraits concept.
T | Type that satisfies HashTraits concept |
t | The object to hash |
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.
|
staticnoexcept |
Hash function specialization for integral types.
T | Integral type |
t | The value to hash |
|
staticnoexcept |
Hash function for pointers.
T | The pointee type |
t | Pointer to hash |
|
noexcept |
Hash function object call operator.
t | The object to hash |