|
|
|
@ -20,4 +20,23 @@ auto generate_random() -> T
|
|
|
|
|
```cpp
|
|
|
|
|
template <class T>
|
|
|
|
|
class T hash_t
|
|
|
|
|
{
|
|
|
|
|
hash_t hash(const T& data, std::size_t hash_result)
|
|
|
|
|
: data {&data}, hash_result{hash_result}
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
std::size_t hash_result;
|
|
|
|
|
const T* data;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
static std::shared_ptr<hash_t> make(const T& data)
|
|
|
|
|
{
|
|
|
|
|
auto hash = std::hash<std::varient<T, std::uint64_t>>{}(data, llo::utils::generate_random<std::uint64_t>());
|
|
|
|
|
|
|
|
|
|
return std::make_shared<hash_t>(data, hash);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
T& get_data() const;
|
|
|
|
|
std::size_t get_hash() const;
|
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|