rippled
Loading...
Searching...
No Matches
uhash.h
1#pragma once
2
3#include <xrpl/beast/hash/hash_append.h>
4#include <xrpl/beast/hash/xxhasher.h>
5
6namespace beast {
7
8// Universal hash function
9template <class Hasher = xxhasher>
10struct uhash
11{
12 uhash() = default;
13
14 using result_type = typename Hasher::result_type;
15
16 template <class T>
18 operator()(T const& t) const noexcept
19 {
20 Hasher h;
21 hash_append(h, t);
22 return static_cast<result_type>(h);
23 }
24};
25
26} // namespace beast
std::enable_if_t< is_contiguously_hashable< T, Hasher >::value > hash_append(Hasher &h, T const &t) noexcept
Logically concatenate input data to a Hasher.
uhash()=default
result_type operator()(T const &t) const noexcept
Definition uhash.h:18
typename Hasher::result_type result_type
Definition uhash.h:14