commit 4c12780: [Minor] Add is_avalanching type hint
Vsevolod Stakhov
vsevolod at rspamd.com
Mon Jul 18 16:42:03 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-07-18 17:38:52 +0100
URL: https://github.com/rspamd/rspamd/commit/4c12780d9dee6a206845d4629026ce5b4e650fe5 (HEAD -> master)
[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<rspamd::css::css_property> {
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<std::size_t>(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<rspamd::css::css_rule> {
public:
+ using is_avalanching = void;
constexpr auto operator()(const rspamd::css::css_rule &rule) const -> auto {
return hash<rspamd::css::css_property>()(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<rspamd::css::css_selector> {
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::size_t>(std::get<tag_id_t>(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<std::string_view>::is_avalanching;
auto operator()(const std::string &a) const {
return ankerl::unordered_dense::hash<std::string>()(a);
}
More information about the Commits
mailing list