From: Vsevolod Stakhov Date: Mon, 18 Jul 2022 16:38:52 +0000 (+0100) Subject: [Minor] Add is_avalanching type hint X-Git-Tag: 3.3~119 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4c12780d9dee6a206845d4629026ce5b4e650fe5;p=rspamd.git [Minor] Add is_avalanching type hint --- 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); }