From 4c12780d9dee6a206845d4629026ce5b4e650fe5 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 18 Jul 2022 17:38:52 +0100 Subject: [PATCH] [Minor] Add is_avalanching type hint --- src/libserver/css/css_property.hxx | 1 + src/libserver/css/css_rule.hxx | 1 + src/libserver/css/css_selector.hxx | 1 + src/libutil/cxx/hash_util.hxx | 1 + 4 files changed, 4 insertions(+) diff --git a/src/libserver/css/css_property.hxx b/src/libserver/css/css_property.hxx index 0e17e39fe..7af6c7bd6 100644 --- a/src/libserver/css/css_property.hxx +++ b/src/libserver/css/css_property.hxx @@ -141,6 +141,7 @@ namespace std { template<> class hash { public: + using is_avalanching = void; /* Mix bits to provide slightly better distribution but being constexpr */ constexpr size_t operator() (const rspamd::css::css_property &prop) const { std::size_t key = 0xdeadbeef ^static_cast(prop.type); diff --git a/src/libserver/css/css_rule.hxx b/src/libserver/css/css_rule.hxx index c942b8795..df385bdad 100644 --- a/src/libserver/css/css_rule.hxx +++ b/src/libserver/css/css_rule.hxx @@ -73,6 +73,7 @@ namespace std { template<> class hash { public: + using is_avalanching = void; constexpr auto operator()(const rspamd::css::css_rule &rule) const -> auto { return hash()(rule.get_prop()); } diff --git a/src/libserver/css/css_selector.hxx b/src/libserver/css/css_selector.hxx index 02cb783c4..f49251338 100644 --- a/src/libserver/css/css_selector.hxx +++ b/src/libserver/css/css_selector.hxx @@ -106,6 +106,7 @@ namespace std { template<> class hash { public: + using is_avalanching = void; auto operator() (const rspamd::css::css_selector &sel) const -> std::size_t { if (sel.type == rspamd::css::css_selector::selector_type::SELECTOR_TAG) { return static_cast(std::get(sel.value)); diff --git a/src/libutil/cxx/hash_util.hxx b/src/libutil/cxx/hash_util.hxx index afad29fa5..86f094083 100644 --- a/src/libutil/cxx/hash_util.hxx +++ b/src/libutil/cxx/hash_util.hxx @@ -80,6 +80,7 @@ struct smart_str_equal { struct smart_str_hash { using is_transparent = void; + using is_avalanching = typename ankerl::unordered_dense::hash::is_avalanching; auto operator()(const std::string &a) const { return ankerl::unordered_dense::hash()(a); } -- 2.39.5