CatapultServer  v0.5.0.1 (Elephant)
Hashers.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "ByteArray.h"
23 #include <cstring>
24 #include <tuple>
25 
26 namespace catapult { namespace utils {
27 
31  template<typename TArray, size_t Offset = 4>
32  struct ArrayHasher {
34  size_t operator()(const TArray& array) const {
35  size_t hash;
36  std::memcpy(static_cast<void*>(&hash), &array[Offset], sizeof(size_t));
37  return hash;
38  }
39  };
40 
42  template<typename TValue>
43  struct BaseValueHasher {
45  size_t operator()(TValue value) const {
46  return static_cast<size_t>(value.unwrap());
47  }
48  };
49 }}
catapult::utils::ArrayHasher::operator()
size_t operator()(const TArray &array) const
Hashes arrayData.
Definition: Hashers.h:34
catapult::utils::BaseValueHasher::operator()
size_t operator()(TValue value) const
Hashes value.
Definition: Hashers.h:45
catapult::utils::BaseValueHasher
Hasher object for a base value.
Definition: Hashers.h:43
ByteArray.h
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::utils::ArrayHasher
Definition: Hashers.h:32