7 namespace telnetpp::detail {
9 constexpr
void hash_combine(std::size_t & )
13 template <
typename Field,
typename... Fields>
14 constexpr
void hash_combine(
15 std::size_t &seed, Field &&field, Fields &&...fields)
17 using field_hash_type = std::remove_const_t<std::remove_reference_t<Field>>;
19 std::hash<field_hash_type> hasher;
20 seed ^= hasher(field) + 0x9E3779B9 + (seed << 6) + (seed >> 2);
21 hash_combine(seed, std::forward<Fields>(fields)...);
26 #define TELNETPP_MAKE_HASHABLE(type, ...) \
31 std::size_t operator()(const type &t) const \
33 std::size_t ret = 0; \
34 telnetpp::detail::hash_combine(ret, __VA_ARGS__); \
40 #define TELNETPP_MAKE_INTRUSIVE_HASH(type) \
45 std::size_t operator()(const type &t) const \
47 std::size_t ret = 0; \
48 t.hash_combine(ret); \