60 template <
typename T1,
typename T2>
70 template <
typename... Ts>
80 template <
typename T, std::
size_t N>
100 template <
typename T, std::
size_t Extent>
105 template <
typename T>
110 template <
typename T>
115 template <
typename T>
120 template <
typename... Ts>
167 template <Hash32or64 HashType = u
int32_t, HashType Seed = ( sizeof( HashType ) == 4 ? constants::FNV_OFFSET_BASIS_32 : constants::FNV_OFFSET_BASIS_64 )>
190 [[nodiscard]]
inline HashType
operator()( std::string_view key )
const noexcept;
198 [[nodiscard]]
inline HashType
operator()(
const std::string& key )
const noexcept;
206 [[nodiscard]]
inline HashType
operator()(
const char* key )
const noexcept;
219 template <
typename TKey>
220 [[nodiscard]]
inline std::enable_if_t<std::is_integral_v<TKey>, HashType>
operator()(
const TKey& key )
const noexcept;
233 template <
typename T>
234 [[nodiscard]]
inline std::enable_if_t<std::is_floating_point_v<T>, HashType>
operator()( T value )
const noexcept;
247 template <
typename T>
248 [[nodiscard]]
inline std::enable_if_t<std::is_pointer_v<T> && !std::is_same_v<T, const char*> && !std::is_same_v<T, char*>, HashType>
operator()( T ptr )
const noexcept;
261 template <
typename TKey>
262 [[nodiscard]]
inline std::enable_if_t<std::is_enum_v<TKey>, HashType>
operator()(
const TKey& key )
const noexcept;
276 template <
typename T,
size_t N>
277 [[nodiscard]]
inline HashType
operator()(
const std::array<T, N>& arr )
const noexcept;
290 template <
typename T>
291 [[nodiscard]]
inline HashType
operator()(
const std::optional<T>& opt )
const noexcept;
305 template <
typename T1,
typename T2>
306 [[nodiscard]]
inline HashType
operator()(
const std::pair<T1, T2>& p )
const noexcept;
320 template <
typename T, std::
size_t Extent = std::dynamic_extent>
321 [[nodiscard]]
inline HashType
operator()( std::span<T, Extent> sp )
const noexcept;
334 template <
typename... Ts>
335 [[nodiscard]]
inline HashType
operator()(
const std::tuple<Ts...>& t )
const noexcept;
348 template <
typename... Ts>
349 [[nodiscard]]
inline HashType
operator()(
const std::variant<Ts...>& var )
const noexcept;
362 template <
typename T>
363 [[nodiscard]]
inline HashType
operator()(
const std::vector<T>& vec )
const noexcept;
379 template <
typename TKey>
380 [[nodiscard]]
inline std::enable_if_t<!std::is_same_v<std::decay_t<TKey>, std::string_view> &&
381 !std::is_same_v<std::decay_t<TKey>, std::string> &&
382 !std::is_same_v<std::decay_t<TKey>,
const char*> &&
383 !std::is_integral_v<TKey> &&
384 !std::is_floating_point_v<TKey> &&
385 !std::is_pointer_v<TKey> &&
386 !std::is_enum_v<TKey> &&
399#include "nfx/detail/hashing/Hasher.inl"
Mathematical constants for hash algorithms.
C++20 concepts and type traits for nfx-hashing library.
General-purpose STL-compatible hash functor supporting multiple types.
HashType operator()(const std::variant< Ts... > &var) const noexcept
Hashes a std::variant by combining index and active alternative's hash.
std::enable_if_t< std::is_enum_v< TKey >, HashType > operator()(const TKey &key) const noexcept
Hashes an enum by its underlying integral value.
std::enable_if_t< std::is_integral_v< TKey >, HashType > operator()(const TKey &key) const noexcept
Hashes an integral type using multiplicative hashing.
std::enable_if_t<!std::is_same_v< std::decay_t< TKey >, std::string_view > &&!std::is_same_v< std::decay_t< TKey >, std::string > &&!std::is_same_v< std::decay_t< TKey >, const char * > &&!std::is_integral_v< TKey > &&!std::is_floating_point_v< TKey > &&!std::is_pointer_v< TKey > &&!std::is_enum_v< TKey > &&!is_std_array< TKey >::value &&!is_std_optional< TKey >::value &&!is_std_pair< TKey >::value &&!is_std_span< TKey >::value &&!is_std_tuple< TKey >::value &&!is_std_variant< TKey >::value &&!is_std_vector< TKey >::value, HashType > operator()(const TKey &key) const noexcept
Hashes custom types using std::hash fallback.
HashType operator()(const std::tuple< Ts... > &t) const noexcept
Hashes a std::tuple by combining hashes of all elements.
HashType operator()(const char *key) const noexcept
Hashes a C-style string using CRC32-C algorithm.
HashType operator()(const std::optional< T > &opt) const noexcept
Hashes a std::optional - nullopt has distinct hash from any value.
void is_transparent
Enables transparent lookup in STL containers.
std::enable_if_t< std::is_floating_point_v< T >, HashType > operator()(T value) const noexcept
Hashes a floating-point value with normalization.
HashType operator()(const std::string &key) const noexcept
Hashes a std::string using CRC32-C algorithm.
HashType operator()(const std::array< T, N > &arr) const noexcept
Hashes a std::array by combining hashes of all elements.
HashType operator()(std::string_view key) const noexcept
Hashes a std::string_view using CRC32-C algorithm.
HashType operator()(std::span< T, Extent > sp) const noexcept
Hashes a std::span by combining hashes of all elements in the view.
HashType operator()(const std::pair< T1, T2 > &p) const noexcept
Hashes a std::pair by combining hashes of both elements.
std::enable_if_t< std::is_pointer_v< T > &&!std::is_same_v< T, const char * > &&!std::is_same_v< T, char * >, HashType > operator()(T ptr) const noexcept
Hashes a pointer by its address.
HashType operator()(const std::vector< T > &vec) const noexcept
Hashes a std::vector by combining size and hashes of all elements.