Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
std::hash_detail::fnv1a_hash< T > Class Template Reference

FNV-1a hash algorithm. More...

Inheritance diagram for std::hash_detail::fnv1a_hash< T >:
Inheritance graph

Public Types

using argument_type = T
 The type of the argument of the function call operator.
 
using result_type = size_t
 The type of the result of the function call operator.
 

Public Member Functions

auto operator() (T const &value) const noexcept -> size_t
 Calculate the hash of a value.
 

Detailed Description

template<typename T>
class std::hash_detail::fnv1a_hash< T >

FNV-1a hash algorithm.

Template Parameters
Tthe type to hash

Implement the Fowler-Noll-Vo hashing algorithm with the 1a variant. This hashing algorithm uses two constants that depend on the bit-length of std::size_t for the current platform.

The algorithm starts with an initial hash value of FNV offset basis. For each byte in the input, XOR the hash with the byte from the input, then multiply it by the FNV prime:

hash := FNV_offset_basis
for each byte_of_data to be hashed do
hash := hash XOR byte_of_data
hash := hash * FNV_prime
return hash
hash function primary template
Definition hash.hpp:138

Member Typedef Documentation

◆ argument_type

template<typename T>
using std::hash_detail::fnv1a_hash< T >::argument_type = T

The type of the argument of the function call operator.

◆ result_type

template<typename T>
using std::hash_detail::fnv1a_hash< T >::result_type = size_t

The type of the result of the function call operator.

Member Function Documentation

◆ operator()()

template<typename T>
auto std::hash_detail::fnv1a_hash< T >::operator() ( T const & value) const -> size_t
inlinenoexcept

Calculate the hash of a value.

Parameters
valueThe value to hash
Returns
The hash of the value

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