25 template<
typename T>
constexpr size_t hash(
const T&
v) {
return std::hash<T>{}(
v); }
32 template<
typename T>
constexpr void combine(std::size_t& seed,
const T&
v) {
33 seed ^=
hash(
v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
89#define CE_REFLECT_HASH(T) \
90 template<> struct std::hash<T> { \
91 inline constexpr size_t operator()(const T& object) const noexcept { \
92 ::CeresEngine::Hasher hasher{object}; \
98template<
typename T,
size_t N>
struct std::hash<T[N]> {
99 inline constexpr size_t operator()(
const T values[N])
const noexcept {
101 for(
size_t i = 0; i < N; i++) {
108template<
typename T,
typename CharTraits,
typename RawAllocator>
109struct std::hash<
CeresEngine::BasicString<T, CharTraits, RawAllocator>>
110 :
public std::hash<std::basic_string<T, CharTraits, CeresEngine::StdAllocator<T, RawAllocator>>> {};
112template<
typename T,
typename CharTraits>
113struct std::hash<
CeresEngine::BasicStringView<T, CharTraits>> :
public std::hash<std::basic_string_view<T, CharTraits>> {};
Definition Application.hpp:19
std::uint64_t UInt64
Definition DataTypes.hpp:26
constexpr UInt32 staticHash32(BasicStringView< T > string, const UInt32 value=0x811c9dc5) noexcept
Definition Hash.hpp:77
constexpr void combine(std::size_t &seed, const T &v)
Generates a new hash for the provided type using the default standard hasher and combines it with a p...
Definition Hash.hpp:32
constexpr UInt64 staticHash64(BasicStringView< T > string, const UInt64 value=0xcbf29ce484222325) noexcept
Definition Hash.hpp:82
auto values(Container &container)
Returns an iterable object that iterates over the values of a map-like container.
Definition Iterator.hpp:400
std::uint32_t UInt32
Definition DataTypes.hpp:23
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
A reflection pre-processor that creates a hash for an object.
Definition Hash.hpp:48
T & object
The object currently being hashed.
Definition Hash.hpp:53
constexpr void func(StringView) noexcept
No-op.
Definition Hash.hpp:66
constexpr Hasher(T &object, const size_t hash=0) noexcept
Creates a new hasher for the given object.
Definition Hash.hpp:59
std::decay_t< T > ReflectedType
The type currently being hashed.
Definition Hash.hpp:50
constexpr void data(StringView) noexcept
Combines the hash with the.
Definition Hash.hpp:63
size_t hash
The computed hash.
Definition Hash.hpp:56