7#include <unordered_map>
11#define USE_HASH_TEXT 1
18constexpr u64 hash64(
const std::string_view str,
u64 hash = 0xcbf29ce484222325)
19 {
return str.empty() ? hash :
hash64(str.substr(1), (hash ^ str[0]) * 0x100000001b3); }
32 #if USE_HASH_TEXT == 1
39 constexpr Hsh(
const std::string_view s)
65 constexpr HshO(
const std::string& s)
73 constexpr HshO(
const std::string_view& s)
90 constexpr bool operator op(const Hsh& lhs, const Hsh& rhs)\
91 { return lhs.hash op rhs.hash; }\
92 constexpr bool operator op(const HshO& lhs, const Hsh& rhs)\
93 { return lhs.hash op rhs.hash; }\
94 constexpr bool operator op(const Hsh& lhs, const HshO& rhs)\
95 { return lhs.hash op rhs.hash; }\
96 constexpr bool operator op(const HshO& lhs, const HshO& rhs)\
97 { return lhs.hash op rhs.hash; }
118template <>
struct hash<
eu::Hsh>
120 std::size_t operator()(
const eu::Hsh& x)
const
125template <>
struct hash<
eu::HshO>
127 std::size_t operator()(
const eu::HshO& x)
const
#define ADD_CATCH_FORMATTER_DEF(TYPE)
std::string string_from(const An &a)
constexpr u64 hash64(const std::string_view str, u64 hash=0xcbf29ce484222325)
fnv-1a hash.
Hash of an owning string.
std::string text
Owning storage of the printable string, if enabled.
constexpr HshO(const std::string &s)
Creates a new hash object and computes the hash at compile time if possible.
constexpr HshO(const Hsh &o)
Copy data from a non-owning hash.
constexpr HshO(const std::string_view &s)
Creates a new hash object and computes the hash at compile time if possible.
Hash of a non-owning string.
constexpr Hsh(const std::string_view s)
Creates a new hash object and computes the hash at compile time if possible.
std::string_view text
Non-owning storage of the printable string, if enabled.