2022-05-21 19:58:09 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include "XXHash.h"
|
|
|
|
|
|
|
|
template<class TType>
|
|
|
|
struct HashComparer
|
|
|
|
{
|
|
|
|
constexpr static uint64_t GetHashCode(TType& Value)
|
|
|
|
{
|
|
|
|
if constexpr (std::is_arithmetic<TType>::value)
|
|
|
|
return Hashing::XXHash::HashValue(Value);
|
|
|
|
else if constexpr (std::is_enum<TType>::value)
|
|
|
|
return Hashing::XXHash::HashValue((uint32_t)Value);
|
2022-05-21 21:51:35 +02:00
|
|
|
else if constexpr (std::is_same<TType, String>::value)
|
2022-05-21 19:58:09 +02:00
|
|
|
return Hashing::XXHash::HashString(Value);
|
|
|
|
}
|
|
|
|
|
|
|
|
constexpr static bool Equals(TType& Lhs, TType& Rhs)
|
|
|
|
{
|
|
|
|
return (Lhs == Rhs);
|
|
|
|
}
|
|
|
|
};
|