libhatchet
Loading...
Searching...
No Matches
hxkey.hpp File Reference

Go to the source code of this file.

Classes

class  hxkey_equal_t< T, enabled_t >
class  hxkey_less_t< T, enabled_t >
class  hxkey_hash_t< T, enabled_t >

Functions

template<typename T>
HX_NS_BEGIN_ constexpr bool hxis_string (void)
template<typename A_, typename B_>
constexpr bool hxkey_equal (const A_ &a_, const B_ &b_)
template<typename A_, typename B_>
constexpr bool hxkey_less (const A_ &a_, const B_ &b_)
template<typename T>
hxhash_t hxkey_hash (const T &x_)

Detailed Description

User-specializable key-equal, key-less, and key-hash callables.

By default these compare with == and <, which works with a defaulted <=> operator, and hash with an xxhash32-derived mix. Override key operations for a type by explicitly specializing hxkey_equal_t, hxkey_less_t, or hxkey_hash_t, the same way std::hash is specialized. Specializations are evaluated when and where the derived container is instantiated and must be consistently available.

Function Documentation

◆ hxis_string()

template<typename T>
HX_NS_BEGIN_ constexpr bool hxis_string ( void )
inlineconstexpr

hxis_string<T> - Checks if T is some kind of char* or char array, ignoring any top level const, volatile or reference qualifiers on T itself.

◆ hxkey_equal()

template<typename A_, typename B_>
bool hxkey_equal ( const A_ & a_,
const B_ & b_ )
inlineconstexpr

hxkey_equal - Returns true if a and b are equivalent, deducing A and invoking hxkey_equal_t<A>.

  • a : The first value to compare.
  • b : The second value to compare.

◆ hxkey_hash()

template<typename T>
hxhash_t hxkey_hash ( const T & x_)
inline

hxkey_hash - Returns the hash of x, deducing T and invoking hxkey_hash_t<T>.

  • x : The value to hash.

◆ hxkey_less()

template<typename A_, typename B_>
bool hxkey_less ( const A_ & a_,
const B_ & b_ )
inlineconstexpr

hxkey_less - Returns true if a is less than b, deducing A and invoking hxkey_less_t<A>.

  • a : The first value to compare.
  • b : The second value to compare.