#include "css_parser.hxx"
#include "contrib/robin-hood/robin_hood.h"
#include "libutil/cxx/util.hxx"
+#include "libutil/cxx/hash_util.hxx"
#include <vector>
#include <memory>
namespace rspamd {
+/*
+ * Transparent smart pointers hashing
+ */
+template<typename T>
+struct smart_ptr_equal {
+ using is_transparent = void; /* We want to find values in a set of shared_ptr by reference */
+ auto operator()(const std::shared_ptr<T> &a, const std::shared_ptr<T> &b) const {
+ return (*a) == (*b);
+ }
+ auto operator()(const std::shared_ptr<T> &a, const T &b) const {
+ return (*a) == b;
+ }
+ auto operator()(const T &a, const std::shared_ptr<T> &b) const {
+ return a == (*b);
+ }
+ auto operator()(const std::unique_ptr<T> &a, const std::unique_ptr<T> &b) const {
+ return (*a) == (*b);
+ }
+ auto operator()(const std::unique_ptr<T> &a, const T &b) const {
+ return (*a) == b;
+ }
+ auto operator()(const T &a, const std::unique_ptr<T> &b) const {
+ return a == (*b);
+ }
+};
+
+template<typename T>
+struct smart_ptr_hash {
+ using is_transparent = void; /* We want to find values in a set of shared_ptr by reference */
+ auto operator()(const std::shared_ptr<T> &a) const {
+ return std::hash<T>()(*a);
+ }
+ auto operator()(const std::unique_ptr<T> &a) const {
+ return std::hash<T>()(*a);
+ }
+ auto operator()(const T &a) const {
+ return std::hash<T>()(a);
+ }
+};
/* Enable lookup by string view */
struct smart_str_equal {
*/
namespace rspamd {
-/*
- * Transparent smart pointers hashing
- */
-template<typename T>
-struct smart_ptr_equal {
- using is_transparent = void; /* We want to find values in a set of shared_ptr by reference */
- auto operator()(const std::shared_ptr<T> &a, const std::shared_ptr<T> &b) const {
- return (*a) == (*b);
- }
- auto operator()(const std::shared_ptr<T> &a, const T &b) const {
- return (*a) == b;
- }
- auto operator()(const T &a, const std::shared_ptr<T> &b) const {
- return a == (*b);
- }
- auto operator()(const std::unique_ptr<T> &a, const std::unique_ptr<T> &b) const {
- return (*a) == (*b);
- }
- auto operator()(const std::unique_ptr<T> &a, const T &b) const {
- return (*a) == b;
- }
- auto operator()(const T &a, const std::unique_ptr<T> &b) const {
- return a == (*b);
- }
-};
-
-template<typename T>
-struct smart_ptr_hash {
- using is_transparent = void; /* We want to find values in a set of shared_ptr by reference */
- auto operator()(const std::shared_ptr<T> &a) const {
- return std::hash<T>()(*a);
- }
- auto operator()(const std::unique_ptr<T> &a) const {
- return std::hash<T>()(*a);
- }
- auto operator()(const T &a) const {
- return std::hash<T>()(a);
- }
-};
-
/*
* Creates std::array from a standard C style array with automatic size calculation
*/