6 #ifndef XENIUM_HASH_HPP
7 #define XENIUM_HASH_HPP
9 #include <xenium/utils.hpp>
16 using hash_t = std::size_t;
26 hash_t operator()(
const Key& key)
const noexcept {
return _hash(key); }
45 hash_t operator()(
const Key* key)
const noexcept {
46 constexpr
auto alignment = std::alignment_of<Key>();
47 constexpr
auto shift = utils::find_last_bit_set(alignment) - 1;
48 auto hash =
reinterpret_cast<hash_t
>(key);
49 assert((
hash >> shift) << shift ==
hash);
Slim wrapper around std::hash with specialization for pointer types.
Definition: hash.hpp:25