Go to the source code of this file.
◆ JPH_DEFINE_TRIVIAL_HASH
#define JPH_DEFINE_TRIVIAL_HASH |
( |
|
type | ) |
|
Value:template <> \
{ \
{ \
return HashBytes(&inValue,
sizeof(inValue)); \
} \
};
std::uint64_t uint64
Definition Core.h:485
JPH_NAMESPACE_BEGIN uint64 HashBytes(const void *inData, uint inSize, uint64 inSeed=0xcbf29ce484222325UL)
Definition HashCombine.h:15
Fallback hash function that calls T::GetHash()
Definition HashCombine.h:59
uint64 operator()(const T &inValue) const
Definition HashCombine.h:60
Helper macro to define a hash function for trivial types.
◆ JPH_MAKE_HASH_STRUCT
#define JPH_MAKE_HASH_STRUCT |
( |
|
type, |
|
|
|
name, |
|
|
|
... |
|
) |
| |
Value: struct [[nodiscard]] name \
{ \
::JPH::uint64 operator()(const type &t) const \
{ \
return ::JPH::HashCombineArgs(__VA_ARGS__); \
} \
};
◆ JPH_MAKE_HASHABLE
#define JPH_MAKE_HASHABLE |
( |
|
type, |
|
|
|
... |
|
) |
| |
Value: JPH_SUPPRESS_WARNING_PUSH \
JPH_SUPPRESS_WARNINGS \
namespace JPH \
{ \
template<> \
JPH_MAKE_HASH_STRUCT(type,
Hash<type>, __VA_ARGS__) \
} \
JPH_SUPPRESS_WARNING_POP \
JPH_MAKE_STD_HASH(type)
◆ JPH_MAKE_STD_HASH
#define JPH_MAKE_STD_HASH |
( |
|
type | ) |
|
Value: JPH_SUPPRESS_WARNING_PUSH \
JPH_SUPPRESS_WARNINGS \
{ \
template<> \
struct [[nodiscard]] hash<type> \
{ \
size_t operator()(const type &t) const \
{ \
return size_t(::JPH::Hash<type>{ }(t)); \
} \
}; \
} \
JPH_SUPPRESS_WARNING_POP
◆ Hash64()
◆ HashBytes()
◆ HashCombine()
template<typename T >
void HashCombine |
( |
uint64 & |
ioSeed, |
|
|
const T & |
inValue |
|
) |
| |
|
inline |
◆ HashCombineArgs()
template<typename FirstValue , typename... Values>
uint64 HashCombineArgs |
( |
const FirstValue & |
inFirstValue, |
|
|
Values... |
inValues |
|
) |
| |
|
inline |
Hash combiner to use a custom struct in an unordered map or set
Usage:
struct SomeHashKey
{
std::string key1;
std::string key2;
bool key3;
};
JPH_MAKE_HASHABLE(SomeHashKey, t.key1, t.key2, t.key3)
◆ HashString()
constexpr uint64 HashString |
( |
const char * |
inString, |
|
|
uint64 |
inSeed = 0xcbf29ce484222325UL |
|
) |
| |
|
constexpr |