33 using value_type = size_t;
34 template<
class H = Hash>
35 static value_type hash(
const Object& obj);
37 static value_type hash(
const std::vector<uint8_t>& raw);
38 static value_type hash(span<const uint8_t> raw);
39 static value_type hash(
const void* raw,
size_t size);
42 template<
typename U = value_type>
43 static value_type combine(value_type lhs, U rhs) {
44 return (lhs ^ rhs) + 0x9e3779b9 + (lhs << 6) + (rhs >> 2);
50 Hash(value_type init_value);
53 virtual Hash& process(
size_t integer);
54 virtual Hash& process(
const std::string& str);
55 virtual Hash& process(
const std::u16string& str);
56 virtual Hash& process(
const std::vector<uint8_t>& raw);
57 virtual Hash& process(span<const uint8_t> raw);
59 template<class T, typename = typename std::enable_if<std::is_enum<T>::value>::type>
61 return process(
static_cast<value_type
>(v));
65 Hash& process(
typename It::iterator v) {
66 return process(std::begin(v), std::end(v));
70 template<
class T,
size_t N>
71 Hash& process(
const std::array<T, N>& array) {
72 process(std::begin(array), std::end(array));
77 Hash& process(
const std::vector<T>& vector) {
78 process(std::begin(vector), std::end(vector));
83 Hash& process(
const std::set<T>& set) {
84 process(std::begin(set), std::end(set));
88 template<
class U,
class V>
89 Hash& process(
const std::pair<U, V>& p) {
95 template<
class InputIt>
96 Hash& process(InputIt begin, InputIt end) {
97 for (
auto&& it = begin; it != end; ++it) {
103 value_type value()
const {
110 value_type value_ = 0;