rippled
Loading...
Searching...
No Matches
uhash.h
1#ifndef BEAST_HASH_UHASH_H_INCLUDED
2#define BEAST_HASH_UHASH_H_INCLUDED
3
4#include <xrpl/beast/hash/hash_append.h>
5#include <xrpl/beast/hash/xxhasher.h>
6
7namespace beast {
8
9// Universal hash function
10template <class Hasher = xxhasher>
11struct uhash
12{
13 uhash() = default;
14
15 using result_type = typename Hasher::result_type;
16
17 template <class T>
19 operator()(T const& t) const noexcept
20 {
21 Hasher h;
22 hash_append(h, t);
23 return static_cast<result_type>(h);
24 }
25};
26
27} // namespace beast
28
29#endif
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:19
typename Hasher::result_type result_type
Definition uhash.h:15