]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add a workaround for old clang
authorVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 18 Jul 2022 16:32:16 +0000 (17:32 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 18 Jul 2022 16:32:16 +0000 (17:32 +0100)
src/libserver/symcache/symcache_impl.cxx

index fe879810b0fe812877c22fb045e0afe79bf0037e..8ffc55db0b68eeabcd02dce309a54462bcbedb1c 100644 (file)
@@ -24,6 +24,7 @@
 #include "fmt/core.h"
 #include "contrib/t1ha/t1ha.h"
 
+#include <version>
 #include <cmath>
 
 namespace rspamd::symcache {
@@ -145,9 +146,17 @@ auto symcache::init() -> bool
                items_by_symbol.erase(deleted_element_refcount->get_name());
 
                auto &additional_vec = get_item_specific_vector(*deleted_element_refcount);
+#if __cplusplus >= 202002L || defined(__cpp_lib_erase_if)
                std::erase_if(additional_vec, [id_to_disable](const cache_item_ptr &elt) {
                        return elt->id == id_to_disable;
                });
+#else
+               auto it = std::remove_if(additional_vec.begin(),
+               additional_vec.end(), [id_to_disable](const cache_item_ptr &elt) {
+                       return elt->id == id_to_disable;
+               });
+               additional_vec.erase(it, additional_vec.end());
+#endif
 
                /* Refcount is dropped, so the symbol should be freed, ensure that nothing else owns this symbol */
                g_assert(deleted_element_refcount.use_count() == 1);