dice-hash
Hash function for stl types and container
|
Class which contains all dice_hash functions. More...
#include <DiceHash.hpp>
Static Public Member Functions | |
template<typename T > | |
static std::size_t | dice_hash (T const &t) noexcept |
Base case for dice_hash. | |
template<typename T > requires is_fundamental<std::decay_t<T>> | |
static std::size_t | dice_hash (T const &fundamental) noexcept |
Implementation for fundamentals. | |
template<typename CharT > | |
static std::size_t | dice_hash (std::basic_string< CharT > const &str) noexcept |
Implementation for string types. | |
template<typename CharT > | |
static std::size_t | dice_hash (std::basic_string_view< CharT > const &sv) noexcept |
Implementation for string view. | |
template<typename T > | |
static std::size_t | dice_hash (T *ptr) noexcept |
Implementation for raw pointers. | |
template<typename T > | |
static std::size_t | dice_hash (std::unique_ptr< T > const &ptr) noexcept |
Implementation for unique pointers. | |
template<typename T > | |
static std::size_t | dice_hash (std::shared_ptr< T > const &ptr) noexcept |
implementation for shared pointers. | |
template<typename T , std::size_t N> | |
static std::size_t | dice_hash (std::array< T, N > const &arr) noexcept |
Implementation for std arrays. | |
template<typename T > | |
static std::size_t | dice_hash (std::vector< T > const &vec) noexcept |
Implementation for vectors. | |
template<typename T , std::size_t Extent> | |
static std::size_t | dice_hash (std::span< T, Extent > const &span) noexcept |
Implementation for byte spans. | |
template<typename... TupleArgs> | |
static std::size_t | dice_hash (std::tuple< TupleArgs... > const &tpl) noexcept |
Implementation for tuples. | |
template<typename T , typename V > | |
static std::size_t | dice_hash (std::pair< T, V > const &p) noexcept |
Implementation for pairs. | |
static std::size_t | dice_hash (std::monostate const &) noexcept |
Overload for std::monostate. | |
template<typename... VariantArgs> | |
static std::size_t | dice_hash (std::variant< VariantArgs... > const &var) noexcept |
Implementation for variant. | |
template<typename T > requires is_ordered_container_v<T> | |
static std::size_t | dice_hash (T const &container) noexcept |
Implementation for ordered container. | |
template<typename T > requires is_unordered_container_v<T> | |
static std::size_t | dice_hash (T const &container) noexcept |
Implementation for unordered container. | |
Class which contains all dice_hash functions.
Policy | The Policy the hash is based on. |
|
inlinestaticnoexcept |
Implementation for std arrays.
It will use different implementations if the type is fundamental or not.
T | The type of the values. |
N | The number of values. |
arr | The array itself. |
|
inlinestaticnoexcept |
Implementation for string types.
CharT | A char type. See the definition of std::string for more information. |
str | The string to hash. |
|
inlinestaticnoexcept |
Implementation for string view.
CharT | A char type. See the definition of std::string for more information. |
sv | The string view to hash. |
|
inlinestaticnoexcept |
Overload for std::monostate.
It is needed so its usage in std::variant is possible. Will simply return the seed.
|
inlinestaticnoexcept |
Implementation for pairs.
Will hash the entries and then combine them.
T | Type of the first value. |
V | Type of the second value. |
p | The pair itself. |
|
inlinestaticnoexcept |
implementation for shared pointers.
CAUTION: hashes the POINTER, not the OBJECT POINTED TO!
T | A shared pointer type. |
ptr | The pointer to hash. |
|
inlinestaticnoexcept |
Implementation for byte spans.
bytes | byte span to hash |
|
inlinestaticnoexcept |
Implementation for tuples.
Will hash every entry and then combine the hashes.
TupleArgs | The types of the tuple values. |
tpl | The tuple itself. |
|
inlinestaticnoexcept |
Implementation for unique pointers.
CAUTION: hashes the POINTER, not the OBJECT POINTED TO!
T | A unique pointer type. |
ptr | The pointer to hash. |
|
inlinestaticnoexcept |
Implementation for variant.
Will hash the value which was set. The hash of a variant of a type is equal to the hash of the type. For example: a variant of int of 42 is equal to the hash of the int of 42. If the variant is valueless_by_exception, the seed will be returned.
VariantArgs | Types of the possible values. |
var | The variant itself. |
|
inlinestaticnoexcept |
Implementation for vectors.
It will use different implementations for fundamental and non-fundamental types.
T | The type of the values. |
vec | The vector itself. |
|
inlinestaticnoexcept |
Implementation for raw pointers.
CAUTION: hashes the POINTER, not the OBJECT POINTED TO!
T | A pointer type. |
ptr | The pointer to hash. |
|
inlinestaticnoexcept |
Implementation for ordered container.
It uses a custom type trait to check if the type is in fact an ordered container. CAUTION: If you want to add another type to the trait, you might need to do it before this is included!
T | The container type. |
container | The container itself. |
|
inlinestaticnoexcept |
Implementation for unordered container.
It uses a custom type trait to check if the type is in fact an unordered container. CAUTION: If you want to add another type to the trait, you might need to do it before this is included!
T | The container type. |
container | The container itself. |
|
inlinestaticnoexcept |
Implementation for fundamentals.
T | Fundamental type. |
fundamental | Value to hash. |
|
inlinestaticnoexcept |
Base case for dice_hash.
This case is only chosen if no other match is found in this struct. Than it tries to find a specialization of dice::hash::dice_hash_overload and if none is found, this function will not compile.
T | The type to hash. |