Use absl::Hash as QuicheLinkedHashMap default hasher.
Credits to MrJia1997 for the suggestion at
https://github.com/google/quiche/issues/10.
In addition to the argument made on that issue, see
https://abseil.io/docs/cpp/guides/hash for additional advantages of absl::Hash
over std::hash.
PiperOrigin-RevId: 414004301
diff --git a/common/quiche_linked_hash_map.h b/common/quiche_linked_hash_map.h
index a52863e..9923df3 100644
--- a/common/quiche_linked_hash_map.h
+++ b/common/quiche_linked_hash_map.h
@@ -23,6 +23,8 @@
#include <utility>
#include "absl/container/node_hash_map.h"
+#include "absl/hash/hash.h"
+#include "common/platform/api/quiche_export.h"
#include "common/platform/api/quiche_logging.h"
namespace quiche {
@@ -34,11 +36,12 @@
// We also keep a set<list::iterator> for find. Since std::list is a
// doubly-linked list, the iterators should remain stable.
-template <class Key,
- class Value,
- class Hash = std::hash<Key>,
- class Eq = std::equal_to<Key>>
-class QuicheLinkedHashMap {
+// QUICHE_NO_EXPORT comments suppress erroneous presubmit failures.
+template <class Key, // QUICHE_NO_EXPORT
+ class Value, // QUICHE_NO_EXPORT
+ class Hash = absl::Hash<Key>, // QUICHE_NO_EXPORT
+ class Eq = std::equal_to<Key>> // QUICHE_NO_EXPORT
+class QUICHE_EXPORT_PRIVATE QuicheLinkedHashMap {
private:
typedef std::list<std::pair<Key, Value>> ListType;
typedef absl::node_hash_map<Key, typename ListType::iterator, Hash, Eq>