18#if HX_USE_MACROS_WITH_MODULE
19#error Header does not provide macros alone.
28template<
typename T_>
struct hxis_string_ :
public hxfalse_t { };
29template<>
struct hxis_string_<char*> :
public hxtrue_t { };
30template<>
struct hxis_string_<const char*> :
public hxtrue_t { };
31template<>
struct hxis_string_<volatile char*> :
public hxtrue_t { };
32template<>
struct hxis_string_<const volatile char*> :
public hxtrue_t { };
33template<
size_t size_>
struct hxis_string_<char[size_]> :
public hxtrue_t { };
34template<
size_t size_>
struct hxis_string_<const char[size_]> :
public hxtrue_t { };
35template<
size_t size_>
struct hxis_string_<volatile char[size_]> :
public hxtrue_t { };
36template<
size_t size_>
struct hxis_string_<const volatile char[size_]> :
public hxtrue_t { };
37template<>
struct hxis_string_<char[]> :
public hxtrue_t { };
38template<>
struct hxis_string_<const char[]> :
public hxtrue_t { };
39template<>
struct hxis_string_<volatile char[]> :
public hxtrue_t { };
40template<>
struct hxis_string_<const volatile char[]> :
public hxtrue_t { };
49 return hxis_string_<hxremove_cvref_t<T_>>::value;
56template<
typename T_=
void,
typename enabled_t=
void>
59 template<
typename A_,
typename B_>
61 bool operator()(
const A_& a_,
const B_& b_)
const {
return a_ == b_; }
70 return ::strcmp(
const_cast<const char*
>(a_),
const_cast<const char*
>(b_)) == 0;
78template<
typename A_,
typename B_>
90template<
typename T_=
void,
typename enabled_t=
void>
93 template<
typename A_,
typename B_>
95 bool operator()(
const A_& a_,
const B_& b_)
const {
return a_ < b_; }
105 return ::strcmp(
const_cast<const char*
>(a_),
const_cast<const char*
>(b_)) < 0;
113template<
typename A_,
typename B_>
132 x_ *= hxhash_prime2_;
134 x_ *= hxhash_prime3_;
145template<
typename T_,
typename enabled_t=
void>
152 h_ +=
static_cast<hxhash_t>(x_) * hxhash_prime3_;
153 h_ = ((h_ << 17u) | (h_ >> 15u)) * hxhash_prime4_;
154 return hxhash_avalanche_(h_);
165 const char* t_ =
const_cast<const char*
>(s_);
168 h_ +=
static_cast<hxhash_t>(
static_cast<unsigned char>(*t_++)) * hxhash_prime5_;
169 h_ = ((h_ << 11u) | (h_ >> 21u)) * hxhash_prime1_;
171 return hxhash_avalanche_(h_);
bool operator()(const volatile char *a_, const volatile char *b_) const
Definition hxkey.hpp:69
hxkey_equal_t<T> - A constexpr callable that returns true if two objects are equivalent.
Definition hxkey.hpp:57
constexpr bool operator()(const A_ &a_, const B_ &b_) const
Definition hxkey.hpp:61
hxhash_t operator()(const volatile char *s_) const
Definition hxkey.hpp:164
hxkey_hash_t<T> - A callable that returns the xxhash32 of a numeric value cast to 32 bits.
Definition hxkey.hpp:146
hxhash_t operator()(const T &x_) const
Definition hxkey.hpp:148
bool operator()(const volatile char *a_, const volatile char *b_) const
Definition hxkey.hpp:104
hxkey_less_t<T> - A constexpr callable that returns true if the first object is less than the second.
Definition hxkey.hpp:91
constexpr bool operator()(const A_ &a_, const B_ &b_) const
Definition hxkey.hpp:95
constexpr bool hxkey_equal(const A_ &a_, const B_ &b_)
hxkey_equal - Returns true if a and b are equivalent, deducing A and invoking hxkey_equal_t<A>.
Definition hxkey.hpp:80
hxhash_t hxkey_hash(const T &x_)
hxkey_hash - Returns the hash of x, deducing T and invoking hxkey_hash_t<T>.
Definition hxkey.hpp:179
HX_NS_BEGIN_ constexpr bool hxis_string(void)
hxis_string<T> - Checks if T is some kind of char* or char array, ignoring any top level const,...
Definition hxkey.hpp:48
constexpr bool hxkey_less(const A_ &a_, const B_ &b_)
hxkey_less - Returns true if a is less than b, deducing A and invoking hxkey_less_t<A>.
Definition hxkey.hpp:115
#define hxinline
hxinline - Force a function to be inlined into its callers.
Definition hxsettings.h:125
#define hxinline_constexpr
hxinline_constexpr - Enables C++17 compatable "inline constexpr" usage for variables so they can be e...
Definition hxsettings.h:275
#define hxattr_nodiscard
hxattr_nodiscard - Indicates the caller should not discard the return value.
Definition hxsettings.h:98
#define hxattr_flatten
hxattr_flatten - Inline every call inside a function's body into it, recursively, regardless of the c...
Definition hxsettings.h:90
#define hxconstexpr
hxconstexpr - Enables C++23 compatable constexpr usage for functions as that has support for destruct...
Definition hxsettings.h:266
A few utility functions and most standard C++ meta programming functions.
Provides core macros, memory management and feature detection.
uint32_t hxhash_t
hxhash_t - Unsigned 32-bit hash value. Expect collisions.
Definition libhatchet.h:210
hxfalse_t - Implements std::false_type.
Definition hxutility.h:112
hxtrue_t - Implements std::true_type.
Definition hxutility.h:110